Skip to content

Commit 930364c

Browse files
update instructions for deferred prebid in client side page
1 parent 342d70b commit 930364c

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

docs/guides/integration-google-ss.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ If you want to use Secure Signals with Prebid.js, you must complete both these a
8484

8585
A sample implementation for Prebid.js with Secure Signals is available at the following links:
8686

87-
- Running site: [UID2 Prebid.js Secure Signals Integration Example](https://prebid-secure-signals.samples.uidapi.com/)
87+
- Site: [UID2 Prebid.js Secure Signals Integration Example](https://prebid-secure-signals.samples.uidapi.com/)
8888
- Code: [uid2-examples/web-integrations/prebid-secure-signals](https://github.com/IABTechLab/uid2-examples/tree/main/web-integrations/prebid-secure-signals)
8989

9090
## Integrating with Single Sign-On (SSO)

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

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ If you need to use an earlier version of Prebid.js, use the implementation solut
3131

3232
An example of the UID2 Prebid.js client-side integration is available at the following links:
3333

34-
- Code: [Example Prebid.js UID2 Integration](https://github.com/IABTechLab/uid2-examples/tree/main/web-integrations/prebid-integrations/client-side)
35-
- Running site: [Client-Side UID2 Integration with Prebid.js](https://prebid-client.samples.uidapi.com/)
34+
- Site: [Client-Side UID2 Integration with Prebid.js](https://prebid-client.samples.uidapi.com/)
35+
- Code: [uid2-examples/web-integrations/prebid-integrations/client-side](https://github.com/IABTechLab/uid2-examples/tree/main/web-integrations/prebid-integrations/client-side)
3636

3737
## Integrating with Single Sign-On (SSO)
3838

@@ -207,9 +207,12 @@ pbjs.setConfig({
207207

208208
## Optional: Deferred Client-Side UID2 Configuration with mergeConfig
209209

210-
If you already have Prebid.js configured but didn't include UID2 in the initial setup, you can still add the UID2 module using `mergeConfig()` and `refreshUserIds()`. This allows Prebid.js to handle all UID2 work—token generation, storage, and refresh—even when UID2 wasn't part of your original configuration.
210+
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:
211211

212-
Instead of using `setConfig()` (which overwrites existing configuration), use `mergeConfig()` to add UID2 without affecting other settings, and then call `refreshUserIds()` to trigger token generation:
212+
- [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.
213+
- [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.
214+
215+
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:
213216

214217
```js
215218
// Step 1: Define the UID2 configuration
@@ -234,18 +237,18 @@ pbjs.mergeConfig(uidConfig);
234237
await pbjs.refreshUserIds({ submoduleNames: ['uid2'] });
235238
```
236239

237-
### Key Points
240+
:::note
241+
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.
238242

239-
- **`mergeConfig()` is additive**: It adds UID2 to the existing `userSync.userIds` array without overwriting other user ID modules.
240-
- **`refreshUserIds()`**: Triggers Prebid to generate/refresh user IDs. Use `{ submoduleNames: ['uid2'] }` to refresh only the UID2 module.
241-
- **Clearing UID2**: Prebid does not provide a built-in way to remove a single user ID module after it's been added. To clear UID2 on logout, remove the token from localStorage and reload the page.
243+
If you are managing the UID2 SDK separately, use `window.__uid2.disconnect()` which handles all logout functionality—clearing both memory and storage—without requiring a page refresh.
244+
:::
242245

243246
### Deferred Client-Side Integration Example
244247

245-
An example of the deferred UID2 Prebid.js integration using `mergeConfig()` is available at the following links:
248+
An example of the deferred UID2 Prebid.js integration is available at the following links:
246249

247-
- Code: [Deferred Prebid.js UID2 Integration](https://github.com/IABTechLab/uid2-examples/tree/main/web-integrations/prebid-integrations/client-side-deferred)
248-
- Running site: [Deferred UID2 Integration with Prebid.js](https://prebid-deferred.samples.uidapi.com/)
250+
- Site: [Deferred UID2 Integration with Prebid.js](https://prebid-deferred.samples.uidapi.com/)
251+
- 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)
249252

250253
## Optional: Prebid.js Integration with Google Secure Signals
251254

0 commit comments

Comments
 (0)