The UID2 framework enables publishers to integrate in either of the following ways:
- Via the standard integration workflow, using the UID2 SDK for JavaScript (also known as the UID2 SDK).
- Via the server-only (custom) integration workflow, by building a direct integration without using the UID2 SDK.
If you are a content publisher interested in generating UID2 tokens for the real-time bidding (RTB) bid stream and want to see how you can use the UID2 services and which integration fits your needs best, you can build and run an example application for each integration.
The following table summarizes both examples and provides links to the example applications, their documentation, and the respective step-by-step integration guides.
| Environment | Documentation | Description | Primary Audience | Integration Guide |
|---|---|---|---|---|
| Node.js | UID2 SDK Integration Example | Demonstrates how to use the UID2 services with the UID2 client SDK to implement the standard UID2 integration workflow. | Publishers with web assets | Client SDK Integration Guide |
| Node.js | Server-Only UID2 Integration Example | Demonstrates how to use the UID2 services to implement a custom (server-only) UID2 integration workflow without relying on an SDK for establishing client UID2 identity and retrieving advertising tokens. | App developers and CTV broadcasters | Server-Only UID2 Integration Guide |
| Java | Java SDK Integration Example | Demonstrates use of the UID2 Java SDK for both a server-only UID2 integration, and a standard (client SDK and server SDK) integration. | Publishers with web assets, app developers, CTV broadcasters | Server-Only; Client SDK |
The example applications illustrate the basic steps that you need to consider for your integration. For example, you need to decide how to do the following:
- Implement user login and logout.
- Manage UID2 identity information and use it for targeted advertising.
- Refresh tokens.
- Deal with missing identities.
- Handle user opt-outs.
This repository includes Docker Compose configuration for easy development and testing of multiple UID2 integration examples.
Start all services:
docker-compose up -dStart a single service:
# Start only the Prebid.js client-side integration
docker-compose up -d prebid-client
# Start with live logs (foreground)
docker-compose up prebid-clientStop services:
# Stop all services
docker-compose down
# Stop a single service
docker-compose stop prebid-clientView logs:
# View all logs
docker-compose logs -f
# View logs for a specific service
docker-compose logs -f prebid-clientRebuild and restart:
# Rebuild and restart all services
docker-compose up -d --build
# Rebuild and restart a single service
docker-compose up -d --build prebid-clientprebid-client- Prebid.js client-side integration (Port: 3031)javascript-sdk-client- JavaScript SDK client-server integration (Port: 3051)- More services will be added as they are containerized
This repository includes sample environment files for both UID2 and EUID configurations:
.env.sample.uid2- UID2 configuration template.env.sample.euid- EUID configuration template
To get started:
-
Copy the appropriate sample file to
.env:# For UID2 cp .env.sample.uid2 .env # For EUID cp .env.sample.euid .env
-
Update the
.envfile with your credentials:- Replace
your-api-keywith your actual API key - Replace
your-client-secretwith your actual client secret - Update other placeholder values as needed
- Replace
The sample files include all necessary environment variables for running the examples, including configuration for:
- Core API endpoints
- JavaScript SDK settings
- Google Secure Signals integration
- Prebid integration
- React client examples
- UI/Display preferences