You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Optional: Deferred Client-Side UID2 Configuration with mergeConfig
209
209
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:
211
211
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:
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.
238
242
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
+
:::
242
245
243
246
### Deferred Client-Side Integration Example
244
247
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:
0 commit comments