Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add rubicon targeting to rubicon bid responses for bidderSettings use #1045

Merged
merged 1 commit into from
Mar 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/adapters/rubicon.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 6 additions & 2 deletions test/spec/adapters/rubicon_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -458,7 +458,7 @@ describe('the rubicon adapter', () => {
{
'key': 'rpfl_14062',
'values': [
'15_tier_all_test'
'43_tier_all_test'
]
}
]
Expand All @@ -482,6 +482,8 @@ describe('the rubicon adapter', () => {
expect(bids[0].ad).to.contain(`alert('foo')`)
.and.to.contain(`<html>`)
.and.to.contain(`<div data-rp-impression-id='153dc240-8229-4604-b8f5-256933b9374d'>`);
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');
Expand All @@ -491,6 +493,8 @@ describe('the rubicon adapter', () => {
expect(bids[1].ad).to.contain(`alert('foo')`)
.and.to.contain(`<html>`)
.and.to.contain(`<div data-rp-impression-id='153dc240-8229-4604-b8f5-256933b9374c'>`);
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', () => {
Expand Down