Skip to content

Commit

Permalink
Adding UsPrivacy/CCPA support in smartadserver adapter. (prebid#5036)
Browse files Browse the repository at this point in the history
Co-authored-by: tadam75 <[email protected]>
  • Loading branch information
2 people authored and iggyfisk committed Jun 22, 2020
1 parent a65705e commit ee7a97d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/smartadserverBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ export const spec = {
payload.gdpr = bidderRequest.gdprConsent.gdprApplies; // we're handling the undefined case server side
}

if (bidderRequest && bidderRequest.uspConsent) {
payload.us_privacy = bidderRequest.uspConsent;
}

var payloadString = JSON.stringify(payload);
return {
method: 'POST',
Expand Down
29 changes: 29 additions & 0 deletions test/spec/modules/smartadserverBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,35 @@ describe('Smart bid adapter tests', function () {
});
});

describe('ccpa/us privacy tests', function () {
afterEach(function () {
config.resetConfig();
$$PREBID_GLOBAL$$.requestBids.removeAll();
});

it('Verify build request with us privacy', function () {
config.setConfig({
'currency': {
'adServerCurrency': 'EUR'
},
consentManagement: {
cmp: 'iab',
consentRequired: true,
timeout: 1000,
allowAuctionWithoutConsent: true
}
});

const uspConsentValue = '1YNN'
const request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, {
uspConsent: uspConsentValue
});
const requestContent = JSON.parse(request[0].data);

expect(requestContent).to.have.property('us_privacy').and.to.equal(uspConsentValue);
});
});

describe('Instream video tests', function () {
afterEach(function () {
config.resetConfig();
Expand Down

0 comments on commit ee7a97d

Please sign in to comment.