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

NextMillennium adapter reading gdprConsent undefined #7806

Closed
hnkhandev opened this issue Dec 3, 2021 · 2 comments · Fixed by #7817
Closed

NextMillennium adapter reading gdprConsent undefined #7806

hnkhandev opened this issue Dec 3, 2021 · 2 comments · Fixed by #7817
Assignees

Comments

@hnkhandev
Copy link
Contributor

Type of issue

Accessing property of possible undefined gdprConsent in request.

Description

Trying to access gdprConsent.gdprApplies and gdprConsent.consentString but not checking if gdprConsent is undefined: https://github.com/prebid/Prebid.js/blob/master/modules/nextMillenniumBidAdapter.js#L41-L55

Solution would look something like this:

if (gdprConsent || uspConsent) {
  postBody.regs = { ext: {} }
}

if (uspConsent) {
  postBody.regs.ext.us_privacy = uspConsent;
}

if (typeof gdprConsent !== 'undefined') {
  if (typeof gdprConsent.gdprApplies !== 'undefined') {
    postBody.regs.ext.gdpr = gdprConsent.gdprApplies ? 1 : 0;
  }
  if (typeof gdprConsent.consentString !== 'undefined') {
    postBody.user = {
      ext: { consent: gdprConsent.consentString }
    }
  }
}

Other information

@mifanich

@ChrisHuie ChrisHuie self-assigned this Dec 4, 2021
@ChrisHuie
Copy link
Collaborator

@hnkhandev @mifanich is there expected to be a pr in the future with these changes?

@mifanich
Copy link
Contributor

mifanich commented Dec 7, 2021

@ChrisHuie @hnkhandev
#7817

@ChrisHuie ChrisHuie linked a pull request Dec 7, 2021 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants