Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core & userId module: reload userIDs when GDPR consent changes #9190

Merged
merged 1 commit into from
Nov 8, 2022

Conversation

dgirardi
Copy link
Collaborator

@dgirardi dgirardi commented Nov 2, 2022

Type of change

  • Bugfix

Description of change

This re-initializes userID modules whenever GDPR consent changes. Fixes an issue where if setConfig({userSync}) is run before setConfig({consentManagement}), the userId module would start initializing without consent and not notice when the latter is set.

@@ -14,8 +16,19 @@ export class ConsentHandler {

#resolve(data) {
this.#ready = true;
const hasChanged = !this.#hasData || !deepEqual(this.#data, data);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So checking if the consent data is exactly the same is what controls the callbacks of the listeners? not just if a setConfig consentManagement occurs?

@robertrmartinez
Copy link
Collaborator

So the userId's are still initialized when consentManagement is not set, thus they will call their endpoint and set ID's without passing consentData right?

But if consent changes, it will call their getId again? And it is up to them to re-do the process again?

Is that correct?

@dgirardi
Copy link
Collaborator Author

dgirardi commented Nov 2, 2022

Yes, that's correct (if the setConfigs are out of order). UserID already has logic to re-run getId if consent management changes, but it does not currently listen for changes, just compares the last consent it saw with what it gets when it inits. (This is to say that getId should not need to be aware that consent changed, the contract is it should always refresh, at least in theory).

The problem with waiting for the setConfig({consentManagement}) is that:

  • we try to resolve both userId and consent before any auction happens, so there's no clear cutoff where we can say "by now, all configs should have been set". This was changed relatively recently, it's no longer true that userId/gdpr only happen at the time of requestBids.
  • currently you can include the gdpr module and never activate it, equivalent to not including it. If we say "when the gdpr module is included, wait for setConfig({consentManagement}), anyone who is not setting it would be left dangling waiting for it until some timeout expires. I don't know if this is preferable.

Copy link
Collaborator

@robertrmartinez robertrmartinez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the quick fix! GDPR and User ID's is always a lot of fun!

@ChrisHuie ChrisHuie merged commit 7046fc2 into prebid:master Nov 8, 2022
dgirardi added a commit to dgirardi/Prebid.js that referenced this pull request Nov 9, 2022
dgirardi added a commit that referenced this pull request Nov 9, 2022
JacobKlein26 pushed a commit to nextmillenniummedia/Prebid.js that referenced this pull request Feb 9, 2023
JacobKlein26 pushed a commit to nextmillenniummedia/Prebid.js that referenced this pull request Feb 9, 2023
jorgeluisrocha pushed a commit to jwplayer/Prebid.js that referenced this pull request May 23, 2023
jorgeluisrocha pushed a commit to jwplayer/Prebid.js that referenced this pull request May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants