Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 23 additions & 18 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,44 @@
services:
prebid-client:
# javascript sdk integrations
javascript-sdk-client-side:
build:
context: .
dockerfile: web-integrations/prebid-integrations/client-side/Dockerfile
dockerfile: web-integrations/javascript-sdk/client-side/Dockerfile
ports:
- "3031:3031"
container_name: prebid-client-side
container_name: javascript-sdk-client-side
env_file:
- .env

# Add more services here as needed
javascript-sdk-client-side:

javascript-sdk-client-server:
build:
context: .
dockerfile: web-integrations/javascript-sdk/client-side/Dockerfile
dockerfile: web-integrations/javascript-sdk/client-server/Dockerfile
ports:
- "3032:3032"
container_name: javascript-sdk-client-side
container_name: javascript-sdk-client-server
env_file:
- .env

# google-secure-signals-client:
# build:
# context: .
# dockerfile: web-integrations/google-secure-signals/client-side/Dockerfile
# ports:
# - "3033:3033"
# container_name: google-secure-signals-client
# secure signals integrations
google-secure-signals-client-server:
build:
context: .
dockerfile: web-integrations/google-secure-signals/client-server/Dockerfile
ports:
- "3041:3041"
container_name: google-secure-signals-client-server
env_file:
- .env

javascript-sdk-client:
# prebid integrations
prebid-client:
build:
context: .
dockerfile: web-integrations/javascript-sdk/client-server/Dockerfile
dockerfile: web-integrations/prebid-integrations/client-side/Dockerfile
ports:
- "3051:3051"
container_name: javascript-sdk-client-server
container_name: prebid-client-side
env_file:
- .env

54 changes: 27 additions & 27 deletions publisher/server_only/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion publisher/server_only/version.json

This file was deleted.

This file was deleted.

This file was deleted.

17 changes: 11 additions & 6 deletions web-integrations/google-secure-signals/client-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
FROM node:20.11-alpine3.18
FROM node:20.11.0-alpine3.18

WORKDIR /usr/src/app
COPY . .

# Copy package files first for better caching
COPY web-integrations/google-secure-signals/client-server/package*.json ./
RUN npm install

RUN apk add --no-cache gettext
RUN mv public/ads.js public/ads.js.template
CMD /bin/sh -c "envsubst < public/ads.js.template > public/ads.js && npm start"
# Copy application files
COPY web-integrations/google-secure-signals/client-server/server.js ./
COPY web-integrations/google-secure-signals/client-server/public ./public/
COPY web-integrations/google-secure-signals/client-server/views ./views/

EXPOSE 3000
EXPOSE 3041
CMD ["npm", "start"]
51 changes: 32 additions & 19 deletions web-integrations/google-secure-signals/client-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,53 @@ For an example application without using the UID2 SDK, see [Server-Side UID2 Int

> NOTE: Although the server side of the example application is implemented in JavaScript using node.js, it is not a requirement. You can use any technology of your choice and refer to the example application for an illustration of the functionality that needs to be implemented.

## Build and Run the Example Application
## Running with Docker

### Using Docker Compose (Recommended)

From the base directory:

```bash
# Start the service
docker-compose up -d google-secure-signals-client

# View logs
docker-compose logs google-secure-signals-client

# Stop the service
docker-compose down google-secure-signals-client
```

### Using Docker directly

From the base directory:

```bash
# Build the image
docker build -f web-integrations/google-secure-signals/client-server/Dockerfile -t google-secure-signals-client .

# Run the container
docker run -p 3052:3052 --env-file .env google-secure-signals-client
```

### Using the VS Code Debugger

The easiest way to try the example is to do the following:

1. Open this repo in VS Code
1. Create a `.env` file in this folder and populate `UID2_API_KEY` and `UID2_CLIENT_SECRET`:
1. Create a `.env` file in the base directory and populate the required variables:
```
UID2_BASE_URL=http://localhost:8080
UID2_API_KEY=<your-integ-API-key>
UID2_CLIENT_SECRET=<your-integ-client-secret>
AD_TAG_URL=https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/extrernal/adx-test-tag&tfcd=0&npa=0&sz=640x480&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=
UID2_JS_SDK_URL=http://localhost:9091/uid2-sdk.js
PORT=3052
```
1. Click the Run and Debug tab or hit `Crtl+Shift+D`
1. Select `Launch Secure Signals (Chrome)` from the configuration dropdown
1. Click `Start Debugging` or hit F5

### Running the Docker commands manually

The other way to try the example is to use the following Docker Build command. First, open this folder in your terminal, then run the following:

```
docker build . -t uid2-secure-signals-standard
docker run -it --rm -p 3000:3000 `
-e UID2_BASE_URL="https://operator-integ.uidapi.com" `
-e UID2_API_KEY="<your-integ-API-key>" `
-e UID2_CLIENT_SECRET="<your-integ-client-secret>" `
-e AD_TAG_URL="https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/extrernal/adx-test-tag&tfcd=0&npa=0&sz=640x480&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=" `
-e UID2_JS_SDK_URL="<your-JS-SDK-URL>" `
uid2-secure-signals-standard
```

The following table lists the environment variables that you must specify to start the application.

| Parameter | Data Type | Description |
Expand All @@ -56,7 +69,7 @@ Output similar to the following indicates that the example application is up and
> [email protected] start /usr/src/app
> node server.js

Example app listening at http://localhost:3000
Example app listening at http://localhost:3052
```

If needed, to close the application, terminate the Docker container or use the `Ctrl+C` keyboard shortcut.
Expand All @@ -67,7 +80,7 @@ The following table outlines and annotates the steps you can take to test and ex

| Step | Description | Comments |
| :--: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 1 | In your browser, navigate to the application main page at `http://localhost:3000`. | The displayed main ([index](views/index.html)) page of the example application provides a login form for the user to complete the UID2 login process.</br>IMPORTANT: A real-life application must also display a form for the user to consent to targeted advertising. |
| 1 | In your browser, navigate to the application main page at `http://localhost:3052`. | The displayed main ([index](views/index.html)) page of the example application provides a login form for the user to complete the UID2 login process.</br>IMPORTANT: A real-life application must also display a form for the user to consent to targeted advertising. |
| 2 | In the text field at the bottom, enter the email address that you want to use for testing and click **Generate UID2**. Note: The button may be labeled different here as it is a testing environment; in a real production environment, labels may differ. | The click calls the Secure Signal [`clearAllCache()`](https://developers.google.com/publisher-tag/reference#googletag.secureSignals.SecureSignalProvidersArray_clearAllCache) function, to clear all cached signals from local storage, and then calls the `/login` endpoint ([server.js](server.js)). The login initiated on the server side then calls the [POST /token/generate](https://unifiedid.com/docs/endpoints/post-token-generate#decrypted-json-response-format) endpoint and processes the received response. |
| | A confirmation message appears with the established UID2 identity information. | The displayed identity information is the `body` property of the [JSON response payload](https://unifiedid.com/docs/endpoints/post-token-generate#decrypted-json-response-format) from the `POST /token/generate` response. It has been passed to the `login` [view](views/login.html) for rendering client-side JavaScript. Next, the identity information is passed to the UID2 SDK [`init()`](https://unifiedid.com/docs/sdks/sdk-ref-javascript#initopts-object-void) function. If the identity is valid, the SDK stores it either in local storage or a first-party UID2 cookie (see [UID2 Storage Format](https://unifiedid.com/docs/sdks/sdk-ref-javascript#uid2-storage-format) for use on subsequent page loads. |
| 3 | Click the **Back to the main page** link. | On the updated application main page, note the newly populated **UID2 Advertising Token** value and a video player. While the [page view](views/index.html) is loading, [GPT](https://developers.google.com/publisher-tag/reference#googletag) auto-loads the Secure Signal UID2 script which pushes the advertising token to GPT local storage, and the [IMA](https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side) makes an ad request which transmits the encoded signal in the request. The [page view](views/index.html) calls the [init()](https://unifiedid.com/docs/sdks/sdk-ref-javascript#initopts-object-void) function again, but this time without passing an explicit identity. Instead, the identity is loaded from the first-party cookie. |
Expand Down
Loading