Skip to content

Commit

Permalink
appnexus bid adapter - add support for auction level keywords (#7951)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnellbaker committed Jan 20, 2022
1 parent e7a3596 commit 1454067
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
11 changes: 11 additions & 0 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,17 @@ export const spec = {
payload.app = appIdObj;
}

let auctionKeywords = config.getConfig('appnexusAuctionKeywords');
if (isPlainObject(auctionKeywords)) {
let aucKeywords = transformBidderParamKeywords(auctionKeywords);

if (aucKeywords.length > 0) {
aucKeywords.forEach(deleteValues);
}

payload.keywords = aucKeywords;
}

if (config.getConfig('adpod.brandCategoryExclusion')) {
payload.brand_category_uniqueness = true;
}
Expand Down
27 changes: 27 additions & 0 deletions test/spec/modules/appnexusBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,33 @@ describe('AppNexusAdapter', function () {
config.getConfig.restore();
});

it('adds auction level keywords to request when set', function() {
let bidRequest = Object.assign({}, bidRequests[0]);
sinon
.stub(config, 'getConfig')
.withArgs('appnexusAuctionKeywords')
.returns({
gender: 'm',
music: ['rock', 'pop'],
test: ''
});

const request = spec.buildRequests([bidRequest]);
const payload = JSON.parse(request.data);

expect(payload.keywords).to.deep.equal([{
'key': 'gender',
'value': ['m']
}, {
'key': 'music',
'value': ['rock', 'pop']
}, {
'key': 'test'
}]);

config.getConfig.restore();
});

it('should attach native params to the request', function () {
let bidRequest = Object.assign({},
bidRequests[0],
Expand Down

0 comments on commit 1454067

Please sign in to comment.