Skip to content

appnexus bid adapter - add support for addtlConsent #6972

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

Merged
merged 1 commit into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ export const spec = {
consent_string: bidderRequest.gdprConsent.consentString,
consent_required: bidderRequest.gdprConsent.gdprApplies
};

if (bidderRequest.gdprConsent.addtlConsent && bidderRequest.gdprConsent.addtlConsent.indexOf('~') !== -1) {
let ac = bidderRequest.gdprConsent.addtlConsent;
// pull only the ids from the string (after the ~) and convert them to an array of ints
let acStr = ac.substring(ac.indexOf('~') + 1);
payload.gdpr_consent.addtl_consent = acStr.split('.').map(id => parseInt(id, 10));
}
}

if (bidderRequest && bidderRequest.uspConsent) {
Expand Down
4 changes: 3 additions & 1 deletion test/spec/modules/appnexusBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,8 @@ describe('AppNexusAdapter', function () {
'timeout': 3000,
'gdprConsent': {
consentString: consentString,
gdprApplies: true
gdprApplies: true,
addtlConsent: '1~7.12.35.62.66.70.89.93.108'
}
};
bidderRequest.bids = bidRequests;
Expand All @@ -691,6 +692,7 @@ describe('AppNexusAdapter', function () {
expect(payload.gdpr_consent).to.exist;
expect(payload.gdpr_consent.consent_string).to.exist.and.to.equal(consentString);
expect(payload.gdpr_consent.consent_required).to.exist.and.to.be.true;
expect(payload.gdpr_consent.addtl_consent).to.exist.and.to.deep.equal([7, 12, 35, 62, 66, 70, 89, 93, 108]);
});

it('should add us privacy string to payload', function() {
Expand Down