Skip to content

Commit d5a15ab

Browse files
authored
appnexus bid adapter - add support for addtlConsent (#6972)
1 parent 0345159 commit d5a15ab

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

modules/appnexusBidAdapter.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,13 @@ export const spec = {
215215
consent_string: bidderRequest.gdprConsent.consentString,
216216
consent_required: bidderRequest.gdprConsent.gdprApplies
217217
};
218+
219+
if (bidderRequest.gdprConsent.addtlConsent && bidderRequest.gdprConsent.addtlConsent.indexOf('~') !== -1) {
220+
let ac = bidderRequest.gdprConsent.addtlConsent;
221+
// pull only the ids from the string (after the ~) and convert them to an array of ints
222+
let acStr = ac.substring(ac.indexOf('~') + 1);
223+
payload.gdpr_consent.addtl_consent = acStr.split('.').map(id => parseInt(id, 10));
224+
}
218225
}
219226

220227
if (bidderRequest && bidderRequest.uspConsent) {

test/spec/modules/appnexusBidAdapter_spec.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,8 @@ describe('AppNexusAdapter', function () {
679679
'timeout': 3000,
680680
'gdprConsent': {
681681
consentString: consentString,
682-
gdprApplies: true
682+
gdprApplies: true,
683+
addtlConsent: '1~7.12.35.62.66.70.89.93.108'
683684
}
684685
};
685686
bidderRequest.bids = bidRequests;
@@ -691,6 +692,7 @@ describe('AppNexusAdapter', function () {
691692
expect(payload.gdpr_consent).to.exist;
692693
expect(payload.gdpr_consent.consent_string).to.exist.and.to.equal(consentString);
693694
expect(payload.gdpr_consent.consent_required).to.exist.and.to.be.true;
695+
expect(payload.gdpr_consent.addtl_consent).to.exist.and.to.deep.equal([7, 12, 35, 62, 66, 70, 89, 93, 108]);
694696
});
695697

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

0 commit comments

Comments
 (0)