Skip to content

Commit

Permalink
added support for addtlConsent (prebid#6005)
Browse files Browse the repository at this point in the history
Co-authored-by: Ix-Prebid-Support <ix-prebid-support@indexexchange.com>
  • Loading branch information
ix-certification and Ix-Prebid-Support authored Feb 8, 2021
1 parent ab9a8d2 commit 19b4885
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/ixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,12 @@ function buildRequest(validBidRequests, bidderRequest, impressions, version) {
r.user.ext = {
consent: gdprConsent.consentString || ''
};

if (gdprConsent.hasOwnProperty('addtlConsent') && gdprConsent.addtlConsent) {
r.user.ext.consented_providers_settings = {
consented_providers: gdprConsent.addtlConsent
}
}
}
}

Expand Down
27 changes: 27 additions & 0 deletions test/spec/modules/ixBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1772,5 +1772,32 @@ describe('IndexexchangeAdapter', function () {
expect(requestWithConsent.regs.ext.gdpr).to.equal(1);
expect(requestWithConsent.regs.ext.us_privacy).to.equal('1YYN');
});

it('should contain `consented_providers_settings.consented_providers` & consent on user.ext when both are provided', function () {
const options = {
gdprConsent: {
consentString: '3huaa11=qu3198ae',
addtlConsent: '1~1.35.41.101',
}
};

const validBidWithConsent = spec.buildRequests(DEFAULT_BANNER_VALID_BID, options);
const requestWithConsent = JSON.parse(validBidWithConsent[0].data.r);
expect(requestWithConsent.user.ext.consented_providers_settings.consented_providers).to.equal('1~1.35.41.101');
expect(requestWithConsent.user.ext.consent).to.equal('3huaa11=qu3198ae');
});

it('should not contain `consented_providers_settings.consented_providers` on user.ext when consent is not provided', function () {
const options = {
gdprConsent: {
addtlConsent: '1~1.35.41.101',
}
};

const validBidWithConsent = spec.buildRequests(DEFAULT_BANNER_VALID_BID, options);
const requestWithConsent = JSON.parse(validBidWithConsent[0].data.r);
expect(utils.deepAccess(requestWithConsent, 'user.ext.consented_providers_settings')).to.not.exist;
expect(utils.deepAccess(requestWithConsent, 'user.ext.consent')).to.not.exist;
});
});
});

0 comments on commit 19b4885

Please sign in to comment.