Deferred Client-Side EUID Integration with Prebid.js
This example demonstrates how to integrate EUID with Prebid.js using deferred configuration.
Unlike the standard integration where EUID is configured on page load, this pattern uses
mergeConfig() and refreshUserIds() to add EUID after the page has loaded.
[Source Code]
๐ Initial Prebid Config (on page load)
Notice: No EUID userIds configured - this is intentional for deferred loading.
What happens when you click "Configure":
pbjs.mergeConfig(uidConfig)- Merges EUID user ID module configuration into the existing Prebid config without overwriting other settings. This allows adding EUID after the page has already loaded.pbjs.refreshUserIds({ submoduleNames: ['euid'] })- Triggers Prebid to re-fetch the EUID user ID specifically, which initiates token generation using the provided email and CSTG credentials.
What happens when you click "Clear":
localStorage.removeItem(storageKey)- Clears the EUID identity from browser storage.location.reload()- Reloads the page to clear Prebid's in-memory cache, preventing future bid requests from using the old token.
Why reload? EUID state lives in browser storage and Prebid's memory. Prebid only reads the tokenโit doesn't provide a method to clear just EUID without affecting other ID modules. Page reload ensures a clean state.
EUID Integration Status
|
Ready for Targeted Advertising:
?
Indicates whether a valid EUID token is present and can be used for personalized ad targeting.
|
|
|
Advertising Token:
?
The encrypted EUID token that is passed to ad systems without exposing raw user identity.
|
|
|
Is Login Required?
?
Indicates whether a new EUID token needs to be generated. Returns "yes" when no valid identity exists or the current identity has expired.
|
|
|
Has Opted Out?
?
Shows whether the user has exercised opt-out, in which case no advertising token may be generated or used.
|
Prebid Integration Status
Prebid.js uses mergeConfig() to add EUID after the page has loaded, then refreshUserIds() triggers token generation.
|
Prebid Token Storage:
?
Shows the EUID token stored by Prebid in localStorage under the key '__euid_advertising_token'. Prebid manages this storage for header bidding.
|