Skip to content

Commit

Permalink
added new param to sonobi adapter: keywords (#4549)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonGoSonobi authored and harpere committed Dec 12, 2019
1 parent 8019d82 commit aabb91f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions modules/sonobiBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ export const spec = {
payload.userid = JSON.stringify(validBidRequests[0].userId);
}

let keywords = validBidRequests[0].params.keywords; // a CSV of keywords

if (keywords) {
payload.kw = keywords;
}

// If there is no key_maker data, then don't make the request.
if (isEmpty(data)) {
return null;
Expand Down
8 changes: 7 additions & 1 deletion test/spec/modules/sonobiBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ describe('SonobiBidAdapter', function () {
},
'bidder': 'sonobi',
'params': {
'keywords': 'sports,news,some_other_keyword',
'placement_id': '1a2b3c4d5e6f1a2b3c4d',
'sizes': [[300, 250], [300, 600]],
'floor': '1.25',
Expand Down Expand Up @@ -341,7 +342,7 @@ describe('SonobiBidAdapter', function () {
expect(bidRequests.data.digkeyv).to.be.undefined;
sandbox.restore();
delete window.DigiTrust;
})
});

it('should return a properly formatted request', function () {
const bidRequests = spec.buildRequests(bidRequest, bidderRequests)
Expand Down Expand Up @@ -539,6 +540,11 @@ describe('SonobiBidAdapter', function () {
expect(bidRequests.data.s).not.to.be.empty;
expect(bidRequests.data.userid).to.equal(undefined);
});

it('should return a properly formatted request with keywrods included as a csv of strings', function() {
const bidRequests = spec.buildRequests(bidRequest, bidderRequests);
expect(bidRequests.data.kw).to.equal('sports,news,some_other_keyword');
});
})

describe('.interpretResponse', function () {
Expand Down

0 comments on commit aabb91f

Please sign in to comment.