diff --git a/src/adapters/rubicon.js b/src/adapters/rubicon.js index 26c540a82f9..6945d64f434 100644 --- a/src/adapters/rubicon.js +++ b/src/adapters/rubicon.js @@ -294,6 +294,12 @@ function RubiconAdapter() { [bid.width, bid.height] = sizeMap[ad.size_id].split('x').map(num => Number(num)); } + // add server-side targeting + bid.rubiconTargeting = (Array.isArray(ad.targeting) ? ad.targeting : []) + .reduce((memo, item) => { + memo[item.key] = item.values[0]; + return memo; + }, {'rpfl_elemid': bidRequest.placementCode}); try { bidmanager.addBidResponse(bidRequest.placementCode, bid); diff --git a/test/spec/adapters/rubicon_spec.js b/test/spec/adapters/rubicon_spec.js index 84503629270..876fd306e37 100644 --- a/test/spec/adapters/rubicon_spec.js +++ b/test/spec/adapters/rubicon_spec.js @@ -291,7 +291,7 @@ describe('the rubicon adapter', () => { expect(bids[0].getStatusCode()).to.equal(CONSTANTS.STATUS.NO_BID); }); - + it('should allow a floor override', () => { var floorBidderRequest = clone(bidderRequest); @@ -458,7 +458,7 @@ describe('the rubicon adapter', () => { { 'key': 'rpfl_14062', 'values': [ - '15_tier_all_test' + '43_tier_all_test' ] } ] @@ -482,6 +482,8 @@ describe('the rubicon adapter', () => { expect(bids[0].ad).to.contain(`alert('foo')`) .and.to.contain(``) .and.to.contain(`
`); + expect(bids[0].rubiconTargeting.rpfl_elemid).to.equal('/19968336/header-bid-tag-0'); + expect(bids[0].rubiconTargeting.rpfl_14062).to.equal('43_tier_all_test'); expect(bids[1].getStatusCode()).to.equal(CONSTANTS.STATUS.GOOD); expect(bids[1].bidderCode).to.equal('rubicon'); @@ -491,6 +493,8 @@ describe('the rubicon adapter', () => { expect(bids[1].ad).to.contain(`alert('foo')`) .and.to.contain(``) .and.to.contain(`
`); + expect(bids[1].rubiconTargeting.rpfl_elemid).to.equal('/19968336/header-bid-tag-0'); + expect(bids[1].rubiconTargeting.rpfl_14062).to.equal('15_tier_all_test'); }); it('should be fine with a CPM of 0', () => {