I'm trying to integrate DigiTrust CMP with Prebid.js but that's not going smoothly so far.
The main problem is that Prebid calls:
https://github.com/prebid/Prebid.js/blob/master/modules/consentManagement.js#L89
cmpFunction('getConsentData', null, callbackHandler.consentDataCallback);
cmpFunction('getVendorConsents', null, callbackHandler.vendorConsentsCallback);
Which return 'undefined' and 'Could not find cookieVersion to encode' if consentData is not available yet.
Instead of instantly returning, the CMP should queue these commands until consent data is available. There is code for this but that doesn't seem to work:
https://github.com/digi-trust/cmp/blob/master/src/lib/cmp.js#L424
Edit: The problem seems to be that this.store.persistedVendorConsentData has been initialized to an empty object at that point. Because of that no command is ever queued. I fixed this by checking for an empty object, but I'm not sure that this is the right way to go.
I'm trying to integrate DigiTrust CMP with Prebid.js but that's not going smoothly so far.
The main problem is that Prebid calls:
https://github.com/prebid/Prebid.js/blob/master/modules/consentManagement.js#L89
Which return 'undefined' and 'Could not find cookieVersion to encode' if consentData is not available yet.
Instead of instantly returning, the CMP should queue these commands until consent data is available. There is code for this but that doesn't seem to work:
https://github.com/digi-trust/cmp/blob/master/src/lib/cmp.js#L424
Edit: The problem seems to be that
this.store.persistedVendorConsentDatahas been initialized to an empty object at that point. Because of that no command is ever queued. I fixed this by checking for an empty object, but I'm not sure that this is the right way to go.