Skip to content

Commit 93f9fe4

Browse files
jbartek25samiul-shantofaisalvs
authored
Improve Digital adapter: support for Google's additional consent (prebid#7787)
* HBT-156: Added Google's additional consent (#1) * HBT-156: Added Google's additional consent * HBT-156: Code refactored Co-authored-by: Faisal Islam <[email protected]> * Update improvedigitalBidAdapter.js Updated version Co-authored-by: Samiul Amin Shanto <[email protected]> Co-authored-by: Faisal Islam <[email protected]>
1 parent 713d923 commit 93f9fe4

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

modules/improvedigitalBidAdapter.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const RENDERER_URL = 'https://acdn.adnxs.com/video/outstream/ANOutstreamVideo.js
1111
const VIDEO_TARGETING = ['skip', 'skipmin', 'skipafter'];
1212

1313
export const spec = {
14-
version: '7.4.0',
14+
version: '7.5.0',
1515
code: BIDDER_CODE,
1616
gvlid: 253,
1717
aliases: ['id'],
@@ -45,8 +45,24 @@ export const spec = {
4545
libVersion: this.version
4646
};
4747

48-
if (bidderRequest && bidderRequest.gdprConsent && bidderRequest.gdprConsent.consentString) {
49-
requestParameters.gdpr = bidderRequest.gdprConsent.consentString;
48+
const gdprConsent = deepAccess(bidderRequest, 'gdprConsent')
49+
if (gdprConsent) {
50+
// GDPR Consent String
51+
if (gdprConsent.consentString) {
52+
requestParameters.gdpr = gdprConsent.consentString;
53+
}
54+
55+
// Additional Consent String
56+
const additionalConsent = deepAccess(gdprConsent, 'addtlConsent');
57+
if (additionalConsent && additionalConsent.indexOf('~') !== -1) {
58+
// Google Ad Tech Provider IDs
59+
const atpIds = additionalConsent.substring(additionalConsent.indexOf('~') + 1);
60+
deepSetValue(
61+
requestParameters,
62+
'user.ext.consented_providers_settings.consented_providers',
63+
atpIds.split('.').map(id => parseInt(id, 10))
64+
);
65+
}
5066
}
5167

5268
if (bidderRequest && bidderRequest.uspConsent) {

test/spec/modules/improvedigitalBidAdapter_spec.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ describe('Improve Digital Adapter Tests', function () {
9292
gdprConsent: {
9393
consentString: 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==',
9494
vendorData: {},
95-
gdprApplies: true
95+
gdprApplies: true,
96+
addtlConsent: '1~1.35.41.101',
9697
},
9798
};
9899

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

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

0 commit comments

Comments
 (0)