Skip to content

Commit 13a9ab5

Browse files
Merge pull request #966 from IABTechLab/eee-UID2-5180-add-documentation-for-prebid-deferred
Update UID2 docs to include up-to-date links and references to sample pages
2 parents 6adf367 + 92be1c9 commit 13a9ab5

8 files changed

+173
-110
lines changed

docs/guides/integration-google-ss.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ If you want to use Secure Signals with Prebid.js, you must complete both these a
8282

8383
For details, see [ESP Configurations](https://docs.prebid.org/dev-docs/modules/userId.html#esp-configurations) in the Prebid documentation.
8484

85+
A sample implementation for Prebid.js with Secure Signals is also available. For details, see [Sample Implementations](#sample-implementations).
86+
8587
## Integrating with Single Sign-On (SSO)
8688

8789
<SnptIntegratingWithSSO />
@@ -154,18 +156,21 @@ For details, see [Client-Side Integration Guide for JavaScript](integration-java
154156

155157
The following sample implementations are available to illustrate how to integrate with the Google Ad Manager secure signals feature:
156158

157-
- Server-side integration example using the UID2 JavaScript SDK with Google secure signals:
158-
- [Sample implementation](https://secure-signals-server-side-integ.uidapi.com/)
159-
- [Code repository](https://github.com/IABTechLab/uid2-web-integrations/tree/main/examples/google-secure-signals-integration/server_side)
160-
- Client-server integration example using the UID2 JavaScript SDK with Google secure signals:
161-
- [Sample implementation](https://secure-signals-client-server-integ.uidapi.com/)
162-
- [Code repository](https://github.com/IABTechLab/uid2-web-integrations/tree/main/examples/google-secure-signals-integration/with_sdk_v3)
163-
- Client-side integration example using the UID2 JavaScript SDK with Google secure signals:
164-
- [Sample implementation](https://secure-signals-client-side-integ.uidapi.com/)
165-
- [Code repository](https://github.com/IABTechLab/uid2-web-integrations/tree/main/examples/google-secure-signals-integration/client_side)
166-
- Client-side integration example using React, the UID2 JavaScript SDK, and Google secure signals:
167-
- [Sample implementation](https://secure-signals-react-integ.uidapi.com)
168-
- [Code repository](https://github.com/IABTechLab/uid2-web-integrations/tree/main/examples/google-secure-signals-integration/react_client_side)
159+
- Client-side integration example using the UID2 JavaScript SDK with Google Secure Signals:
160+
- Site: [Client-Side UID2 Integration with Google Secure Signals](https://secure-signals-client-side.samples.uidapi.com/)
161+
- Code: [uid2-examples/web-integrations/google-secure-signals/client-side](https://github.com/IABTechLab/uid2-examples/tree/main/web-integrations/google-secure-signals/client-side)
162+
- Client-server integration example using the UID2 JavaScript SDK with Google Secure Signals:
163+
- Site: [Client-Server UID2 SDK Integration Example with Google Secure Signals](https://secure-signals-client-server.samples.uidapi.com/)
164+
- Code: [uid2-examples/web-integrations/google-secure-signals/client-server](https://github.com/IABTechLab/uid2-examples/tree/main/web-integrations/google-secure-signals/client-server)
165+
- Server-side integration example using the UID2 JavaScript SDK with Google Secure Signals:
166+
- Site: [Server-Side UID2 Integration with Google Secure Signals](https://secure-signals-server-side.samples.uidapi.com/)
167+
- Code: [uid2-examples/web-integrations/google-secure-signals/server-side](https://github.com/IABTechLab/uid2-examples/tree/main/web-integrations/google-secure-signals/server-side)
168+
- Client-side integration example using React, the UID2 JavaScript SDK, and Google Secure Signals:
169+
- Site: [React Client-Side UID2 Integration with Google Secure Signals](https://secure-signals-react.samples.uidapi.com/)
170+
- Code: [uid2-examples/web-integrations/google-secure-signals/react-client-side](https://github.com/IABTechLab/uid2-examples/tree/main/web-integrations/google-secure-signals/react-client-side)
171+
- Client-side integration example using Prebid.js with Google Secure Signals:
172+
- Site: [Client-Side UID2 Integration with Prebid.js (with Google Secure Signals)](https://prebid-secure-signals.samples.uidapi.com/)
173+
- Code: [uid2-examples/web-integrations/prebid-secure-signals](https://github.com/IABTechLab/uid2-examples/tree/main/web-integrations/prebid-secure-signals)
169174

170175
Each sample implementation has its own instructions.
171176

docs/guides/integration-javascript-client-server.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ If you prefer to integrate with UID2 via **only** client-side JavaScript changes
2222

2323
For technical details about the SDK, see [SDK for JavaScript Reference Guide](../sdks/sdk-ref-javascript.md).
2424

25-
## Sample Implementation
26-
27-
For a sample implementation, see the UID2 SDK Integration example:
28-
- [Client-Server UID2 SDK Integration Example](https://example-jssdk-integ.uidapi.com/)
29-
- [Code Repository with Readme](https://github.com/IABTechLab/uid2-web-integrations/tree/main/examples/js-sdk)
30-
3125
## Introduction
3226

3327
This guide outlines the basic steps that you need to consider if you are building an integration without using an SDK. For example, you need to decide how to implement user authentication and data capture, how to manage UID2 identity information and use it for targeted advertising, and how to refresh tokens, deal with missing identities, and handle user opt-outs.
@@ -36,7 +30,7 @@ For a workflow diagram, see [Integration Steps](#integration-steps). See also [F
3630

3731
For details about the UID2 opt-out workflow and how users can opt out, see [User Opt-Out](../getting-started/gs-opt-out.md).
3832

39-
To facilitate the process of establishing client identity using UID2 and retrieving advertising tokens, the web integration steps provided in this guide rely on the SDK for JavaScript. Here's an [example application](https://example-jssdk-integ.uidapi.com/) that illustrates the integration steps described in this guide and the usage of the SDK (currently only for email addresses). For the application documentation, see [UID2 SDK Integration Example](https://github.com/IABTechLab/uid2-web-integrations/tree/main/examples/js-sdk).
33+
To facilitate the process of establishing client identity using UID2 and retrieving advertising tokens, the web integration steps provided in this guide rely on the SDK for JavaScript. For an example, see [Sample Implementation](#sample-implementation).
4034

4135
:::tip
4236
The first-party cookie and local storage implementation details might change in the future. To avoid potential issues, be sure to rely on the functionality documented in the [SDK for JavaScript API Reference](../sdks/sdk-ref-javascript.md#api-reference) for your identity management.
@@ -175,6 +169,13 @@ The client lifecycle is complete when the user decides to log out from the publi
175169
</script>
176170
```
177171

172+
## Sample Implementation
173+
174+
A sample implementation is available for client-server integration using the UID2 SDK for JavaScript:
175+
176+
- Site: [Client-Server UID2 Integration Example using JavaScript SDK](https://js-client-server.samples.uidapi.com/)
177+
- Code: [uid2-examples/web-integrations/javascript-sdk/client-server](https://github.com/IABTechLab/uid2-examples/tree/main/web-integrations/javascript-sdk/client-server)
178+
178179
## FAQs
179180

180181
For a list of frequently asked questions for the publisher audience, see [FAQs for Publishers](../getting-started/gs-faqs.md#faqs-for-publishers).

docs/guides/integration-javascript-client-side.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,6 @@ If you want to use a debug build of the SDK, use the following URL instead:
5757

5858
- [https://cdn.integ.uidapi.com/uid2-sdk-4.0.1.js](https://cdn.integ.uidapi.com/uid2-sdk-4.0.1.js)
5959

60-
## Sample Implementation
61-
62-
For a sample implementation, see this example:
63-
- Code: [Example Client-Side Integration for JavaScript](https://github.com/IABTechLab/uid2-web-integrations/tree/main/examples/cstg)
64-
- Running site: [Client-Side Integration Example, UID2 JavaScript SDK](https://cstg-integ.uidapi.com/)
65-
66-
<!-- (Source code for running site: https://github.com/IABTechLab/uid2-web-integrations) -->
67-
6860
## Integrating with Single Sign-On (SSO)
6961

7062
<SnptIntegratingWithSSO />
@@ -407,3 +399,10 @@ function bytesToBase64(bytes) {
407399
return btoa(binString);
408400
}
409401
```
402+
403+
## Sample Implementation
404+
405+
A sample implementation is available for client-side integration using the UID2 SDK for JavaScript:
406+
407+
- Site: [Client-Side UID2 Integration Example using JavaScript SDK](https://js-client-side.samples.uidapi.com/)
408+
- Code: [uid2-examples/web-integrations/javascript-sdk/client-side](https://github.com/IABTechLab/uid2-examples/tree/main/web-integrations/javascript-sdk/client-side)

docs/guides/integration-prebid-client-server.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ Information about how to integrate Prebid with UID2 is also in the following loc
3636
- On the Prebid site, on the [Unified ID 2.0](https://docs.prebid.org/dev-docs/modules/userid-submodules/unified2.html) page for the Prebid User ID submodule.
3737
- In the Prebid GitHub repository, on the [UID2 User ID Submodule](https://github.com/prebid/Prebid.js/blob/master/modules/uid2IdSystem.md) page.
3838

39-
<!-- ## Integration Example
40-
41-
GWH note 12/14/23 updated 2/7/25: we have a client-side example for Prebid.js but no client-server example. -->
42-
4339
## Integrating with Single Sign-On (SSO)
4440

4541
<SnptIntegratingWithSSO />
@@ -394,3 +390,11 @@ if you're using Prebid.js, and you're planning to pass UID2 tokens to Google usi
394390

395391
- In your Google Ad Manager account, make sure that encrypted signals are properly shared with third-party bidders: see [Allow Secure Signals Sharing](integration-google-ss.md#allow-secure-signals-sharing).
396392
- Update your Prebid.js configuration: see [Optional: Enable Secure Signals in Prebid.js](integration-google-ss.md#optional-enable-secure-signals-in-prebidjs).
393+
394+
## Sample Implementation
395+
396+
The following sample implementation is available to illustrate how to integrate UID2 with Prebid.js using client-server integration:
397+
398+
- Client-server integration example using Prebid.js:
399+
- Site: [Client-Server UID2 Integration with Prebid.js](https://prebid-client-server.samples.uidapi.com/)
400+
- Code: [uid2-examples/web-integrations/prebid-integrations/client-server](https://github.com/IABTechLab/uid2-examples/tree/main/web-integrations/prebid-integrations/client-server)

docs/guides/integration-prebid-client-side.md

Lines changed: 58 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ This implementation requires Prebid.js version 8.21.0 or later. For version info
2727

2828
If you need to use an earlier version of Prebid.js, use the implementation solution presented in the [UID2 Client-Server Integration Guide for Prebid.js](integration-prebid-client-server.md) instead.
2929

30-
## Integration Example
31-
32-
An example of the UID2 Prebid.js client-side integration is available at the following links:
33-
34-
- Code: [Example Prebid.js UID2 Integration](https://github.com/IABTechLab/uid2docs/tree/main/static/examples/cstg-prebid-example)
35-
- Running site: [UID2 Prebid.js Client-Side Integration Example](https://unifiedid.com/examples/cstg-prebid-example/)
36-
3730
## Integrating with Single Sign-On (SSO)
3831

3932
<SnptIntegratingWithSSO />
@@ -205,9 +198,67 @@ pbjs.setConfig({
205198
});
206199
```
207200

201+
## Optional: Deferred Client-Side UID2 Configuration with mergeConfig
202+
203+
If you already have Prebid.js configured but didn't include UID2 in the initial setup, you can still add the UID2 module using two functions provided by Prebid.js:
204+
205+
- [mergeConfig()](https://docs.prebid.org/dev-docs/publisher-api-reference/mergeConfig.html): Merges new configuration into the existing Prebid config without overwriting other settings. Use this to add the UID2 module to your existing `userSync.userIds` array.
206+
- [refreshUserIds()](https://docs.prebid.org/dev-docs/publisher-api-reference/refreshUserIds.html): Reruns the user ID submodules to fetch the latest IDs. Call this after `mergeConfig()` to trigger UID2 token generation.
207+
208+
You still pass the same configuration information as described above (API base URL, credentials, and DII) so that Prebid can handle the entire UID2 token lifecycle:
209+
210+
```js
211+
// Step 1: Define the UID2 configuration
212+
const uidConfig = {
213+
userSync: {
214+
userIds: [{
215+
name: 'uid2',
216+
params: {
217+
uid2ApiBase: 'https://operator-integ.uidapi.com',
218+
219+
subscriptionId: subscriptionId,
220+
serverPublicKey: publicKey
221+
}
222+
}]
223+
}
224+
};
225+
226+
// Step 2: Merge UID2 config into existing Prebid config (additive, won't overwrite)
227+
pbjs.mergeConfig(uidConfig);
228+
229+
// Step 3: Trigger user ID refresh to generate the token
230+
await pbjs.refreshUserIds({ submoduleNames: ['uid2'] });
231+
```
232+
233+
:::note
234+
Once you add UID2 to your configuration, Prebid does not provide functionality to remove individual submodules without overwriting the entire `userIds` array. For client-side integrations where Prebid has access to the UID2 token in localStorage, it is important to clear localStorage where the token is stored after the user logs out and reload the page to clear caches. This prevents future bid requests from using the identity.
235+
236+
If you are managing the UID2 SDK separately, use `window.__uid2.disconnect()` which handles all logout functionality&#8212;clearing both memory and storage&#8212;without requiring a page refresh.
237+
:::
238+
239+
A sample implementation for deferred configuration is also available. For details, see [Sample Implementations](#sample-implementations).
240+
208241
## Optional: Prebid.js Integration with Google Secure Signals
209242

210243
if you're using Prebid.js, and you're planning to pass UID2 tokens to Google using Google Secure Signals, there are a couple of additional configuration steps:
211244

212245
- In your Google Ad Manager account, make sure that encrypted signals are properly shared with third-party bidders: see [Allow Secure Signals Sharing](integration-google-ss.md#allow-secure-signals-sharing).
213246
- Update your Prebid.js configuration: see [Optional: Enable Secure Signals in Prebid.js](integration-google-ss.md#optional-enable-secure-signals-in-prebidjs).
247+
248+
A sample implementation for Prebid.js with Secure Signals is also available. For details, see [Sample Implementations](#sample-implementations).
249+
250+
## Sample Implementations
251+
252+
The following sample implementations are available to illustrate how to integrate UID2 with Prebid.js on the client side:
253+
254+
- Client-side integration example using Prebid.js:
255+
- Site: [Client-Side UID2 Integration with Prebid.js](https://prebid-client.samples.uidapi.com/)
256+
- Code: [uid2-examples/web-integrations/prebid-integrations/client-side](https://github.com/IABTechLab/uid2-examples/tree/main/web-integrations/prebid-integrations/client-side)
257+
- Deferred client-side integration example using Prebid.js:
258+
- Site: [Deferred Client-Side UID2 Integration with Prebid.js](https://prebid-deferred.samples.uidapi.com/)
259+
- Code: [uid2-examples/web-integrations/prebid-integrations/client-side-deferred](https://github.com/IABTechLab/uid2-examples/tree/main/web-integrations/prebid-integrations/client-side-deferred)
260+
- Client-side integration example using Prebid.js with Google Secure Signals:
261+
- Site: [Client-Side UID2 Integration with Prebid.js (with Google Secure Signals)](https://prebid-secure-signals.samples.uidapi.com/)
262+
- Code: [uid2-examples/web-integrations/prebid-secure-signals](https://github.com/IABTechLab/uid2-examples/tree/main/web-integrations/prebid-secure-signals)
263+
264+
Each sample implementation has its own instructions.

docs/guides/integration-publisher-server-side.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ If the user logs out, do not use the UID2 token.
131131

132132
## Sample Implementation
133133

134-
A sample implementation is available for server-side integration. See:
134+
A sample implementation is available for server-side integration:
135135

136-
- [Server-Only UID2 Integration Example](https://example-srvonly-integ.uidapi.com/login)
137-
- [Server-Only UID2 Integration Example (readme)](https://github.com/IABTechLab/uid2-examples/blob/main/publisher/server_only/README.md)
136+
- Site: [Server-Side UID2 Integration Example](https://server-side.samples.uidapi.com/)
137+
- Code: [uid2-examples/web-integrations/server-side](https://github.com/IABTechLab/uid2-examples/tree/main/web-integrations/server-side)
138138

139139
## FAQs
140140

0 commit comments

Comments
 (0)