Skip to content
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
20 changes: 18 additions & 2 deletions modules/improvedigitalBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,24 @@ export const spec = {
libVersion: this.version
};

if (bidderRequest && bidderRequest.gdprConsent && bidderRequest.gdprConsent.consentString) {
requestParameters.gdpr = bidderRequest.gdprConsent.consentString;
const gdprConsent = deepAccess(bidderRequest, 'gdprConsent')
if (gdprConsent) {
// GDPR Consent String
if (gdprConsent.consentString) {
requestParameters.gdpr = gdprConsent.consentString;
}

// Additional Consent String
const additionalConsent = deepAccess(gdprConsent, 'addtlConsent');
if (additionalConsent && additionalConsent.indexOf('~') !== -1) {
// Google Ad Tech Provider IDs
const atpIds = additionalConsent.substring(additionalConsent.indexOf('~') + 1);
deepSetValue(
requestParameters,
'user.ext.consented_providers_settings.consented_providers',
atpIds.split('.').map(id => parseInt(id, 10))
);
}
}

if (bidderRequest && bidderRequest.uspConsent) {
Expand Down
4 changes: 3 additions & 1 deletion test/spec/modules/improvedigitalBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ describe('Improve Digital Adapter Tests', function () {
gdprConsent: {
consentString: 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==',
vendorData: {},
gdprApplies: true
gdprApplies: true,
addtlConsent: '1~1.35.41.101',
},
};

Expand Down Expand Up @@ -278,6 +279,7 @@ describe('Improve Digital Adapter Tests', function () {
const request = spec.buildRequests([bidRequest], bidderRequestGdpr)[0];
const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length)));
expect(params.bid_request.gdpr).to.equal('BOJ/P2HOJ/P2HABABMAAAAAZ+A==');
expect(params.bid_request.user.ext.consented_providers_settings.consented_providers).to.exist.and.to.deep.equal([1, 35, 41, 101]);
});

it('should add CCPA consent string', function () {
Expand Down