Skip to content

Commit

Permalink
added CCPA support to sonobi bidder adapter (prebid#4617)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonGoSonobi authored and sa1omon committed Dec 19, 2019
1 parent 2098bb6 commit 591c79d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion modules/sonobiBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ export const spec = {
payload.kw = keywords;
}

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

// If there is no key_maker data, then don't make the request.
if (isEmpty(data)) {
return null;
Expand Down Expand Up @@ -236,7 +240,7 @@ export const spec = {
/**
* Register User Sync.
*/
getUserSyncs: (syncOptions, serverResponses) => {
getUserSyncs: (syncOptions, serverResponses, gdprConsent, uspConsent) => {
const syncs = [];
try {
if (syncOptions.pixelEnabled) {
Expand Down
10 changes: 8 additions & 2 deletions test/spec/modules/sonobiBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@ describe('SonobiBidAdapter', function () {
'reachedTop': true,
'referer': 'https://example.com',
'stack': ['https://example.com']
}
},
uspConsent: 'someCCPAString'
};
it('should include the digitrust id and keyv', () => {
window.DigiTrust = {
Expand Down Expand Up @@ -545,7 +546,12 @@ describe('SonobiBidAdapter', function () {
const bidRequests = spec.buildRequests(bidRequest, bidderRequests);
expect(bidRequests.data.kw).to.equal('sports,news,some_other_keyword');
});
})

it('should return a properly formatted request with us_privacy included', function() {
const bidRequests = spec.buildRequests(bidRequest, bidderRequests);
expect(bidRequests.data.us_privacy).to.equal('someCCPAString');
});
});

describe('.interpretResponse', function () {
const bidRequests = {
Expand Down

0 comments on commit 591c79d

Please sign in to comment.