Prebid.js: User ID module not getting data from GDPR consent module
Bug or unhandled corner case of implementation
Description
We’re using OneTrust CMP (to provide us with consent string from TCF API v2) first as a fast loaded stub (tcf.stub.js), which gets filled later on. This works great for bid requests, adapters seem to be getting the consent correctly. Problem comes with passing the string into user ID module ID5. The module is not getting the consent data, therefore it’s sending an empty string.
I think it might be caused by the delayed CMP loading, but it’s just a guess at the moment.
Steps to reproduce
- Add iab (TCF v2) compliant CMP, ideally OneTrust, which is using the stub loading method
- Add latest Prebid with id5 module and GDPR consent module
- Configure according to the example at the bottom of this page: https://console.id5.io/docs/public/prebid
Test page
We have a demo page to test both the CMP and ID5 sync: https://demo.cpex.cz/cmp/
Open it with network debugger open and (if you don’t already have id5 cookie) you should see the id5 server request: https://id5-sync.com/g/v1/250.json?1puid=&gdpr=0&gdpr_consent=
Expected results
The module should wait for the consent data, the same way as bidder adapters seem to do. The id5 network request should therefore contain gdpr=1
and the consent string.
Actual results
The consent is not present.
Platform details
I’m testing on Prebid 3.23.0, chrome, mac os
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 28 (13 by maintainers)
Commits related to this issue
- UserID module: better initialization logic This updates the userID module to avoid premature initialization (https://github.com/prebid/Prebid.js/issues/5447): - `pbjs.getUserIds` and `pbjs.getUserI... — committed to dgirardi/Prebid.js by dgirardi 2 years ago
- UserID module: better initialization logic (#8201) * UserID module: better initialization logic This updates the userID module to avoid premature initialization (https://github.com/prebid/Prebid.j... — committed to prebid/Prebid.js by dgirardi 2 years ago
- UserID module: better initialization logic (#8201) * UserID module: better initialization logic This updates the userID module to avoid premature initialization (https://github.com/prebid/Prebid.j... — committed to JoelPM/Prebid.js by dgirardi 2 years ago
@EskelCz I opened https://github.com/prebid/Prebid.js/issues/8311 to discuss this
Patrick and I discussed. Prebid.js must support a way that the page can call the following two functions and be guaranteed that the answer is valid – i.e. that the module has been initialized:
We propose that the initialization of the userID subsystem is considered ‘complete’ when these three conditions are met:
The implementation of this could be a callback or promise - at the engineer’s discretion.
This is potentially relevant to publishers using a script to collect ids for a gam encrypted signal?
Debugging with the https://demo.cpex.cz/cmp/ it does not seem to be an issue with Prebid.js.
Due the the way Prebid.js is integrated in your page, when prebid initializes after initial load (using pbjs.processQueue()😉, the configs are not set yet. At this point no prebid modules including userId are initialized. However, during the course of your page load, cpexAnalyticsAdaptor.js makes an explicit call to prebidjs’s userId module which cause initialization outside of usual flow for PrebidJS. Due to this explicit call, Prebid.js has no way of maintining module dependencies. Following is the code in cpexAnalyticsAdaptor.js which does this. line number 27 const userIds = $$PREBID_GLOBAL$$.getUserIds();
When the bid request is made, the configured modules are called in order but userId retains the initial GDPR consent and will not reinitialize.
A simple fix for you would be to remove the explicite call to getUserIds() in cpexAnalyticsAdaptor.js and try. Once done, you need to make sure that only once all the initializations are done.
One way to achieve this would to be build your cpexAnalyticsAdaptor as a a hook maybe.