Skip to content

Commit

Permalink
PBS adapter: remove condition on gdpr consentstring which isnt requir…
Browse files Browse the repository at this point in the history
…ed by the tcf2 spec when gdprapplies is false (#6429)

* Update index.js

* Update prebidServerBidAdapter_spec.js

* Update prebidServerBidAdapter_spec.js

* Update prebidServerBidAdapter_spec.js
  • Loading branch information
patmmccann authored and idettman committed May 21, 2021
1 parent 6591dec commit 1164a7f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
7 changes: 2 additions & 5 deletions modules/prebidServerBidAdapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,14 @@ function queueSync(bidderCodes, gdprConsent, uspConsent, s2sConfig) {
}

if (gdprConsent) {
// only populate gdpr field if we know CMP returned consent information (ie didn't timeout or have an error)
if (typeof gdprConsent.consentString !== 'undefined') {
payload.gdpr = (gdprConsent.gdprApplies) ? 1 : 0;
}
payload.gdpr = (gdprConsent.gdprApplies) ? 1 : 0;
// attempt to populate gdpr_consent if we know gdprApplies or it may apply
if (gdprConsent.gdprApplies !== false) {
payload.gdpr_consent = gdprConsent.consentString;
}
}

// US Privace (CCPA) support
// US Privacy (CCPA) support
if (uspConsent) {
payload.us_privacy = uspConsent;
}
Expand Down
6 changes: 3 additions & 3 deletions test/spec/modules/prebidServerBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ describe('S2S Adapter', function () {
expect(requestBid.gdpr_consent).is.undefined;
});

it('checks gdpr info gets added to cookie_sync request: consent data unknown', function () {
it('checks gdpr info gets added to cookie_sync request: applies is false', function () {
let cookieSyncConfig = utils.deepClone(CONFIG);
cookieSyncConfig.syncEndpoint = 'https://prebid.adnxs.com/pbs/v1/cookie_sync';

Expand All @@ -649,7 +649,7 @@ describe('S2S Adapter', function () {
let gdprBidRequest = utils.deepClone(BID_REQUESTS);
gdprBidRequest[0].gdprConsent = {
consentString: undefined,
gdprApplies: undefined
gdprApplies: false
};

const s2sBidRequest = utils.deepClone(REQUEST);
Expand All @@ -658,7 +658,7 @@ describe('S2S Adapter', function () {
adapter.callBids(s2sBidRequest, gdprBidRequest, addBidResponse, done, ajax);
let requestBid = JSON.parse(server.requests[0].requestBody);

expect(requestBid.gdpr).is.undefined;
expect(requestBid.gdpr).is.equal(0);
expect(requestBid.gdpr_consent).is.undefined;
});
});
Expand Down

0 comments on commit 1164a7f

Please sign in to comment.