Skip to content

Commit

Permalink
Now passbacks are bids with zero CPM (#3473)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Ivanchenko authored and jsnellbaker committed Jan 28, 2019
1 parent e3c652f commit afdfecf
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
25 changes: 12 additions & 13 deletions modules/adliveBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { BANNER } from '../src/mediaTypes';

const BIDDER_CODE = 'adlive';
const ENDPOINT_URL = 'https://api.publishers.adlive.io/get?pbjs=1';

const CURRENCY = 'USD';
const TIME_TO_LIVE = 360;

Expand Down Expand Up @@ -43,19 +44,17 @@ export const spec = {
const bidResponses = [];

utils._each(response, function(bidResponse) {
if (!bidResponse.is_passback) {
bidResponses.push({
requestId: bidRequest.bidId,
cpm: bidResponse.price,
width: bidResponse.size[0],
height: bidResponse.size[1],
creativeId: bidResponse.hash,
currency: CURRENCY,
netRevenue: false,
ttl: TIME_TO_LIVE,
ad: bidResponse.content
});
}
bidResponses.push({
requestId: bidRequest.bidId,
cpm: bidResponse.is_passback ? 0 : bidResponse.price,
width: bidResponse.size[0],
height: bidResponse.size[1],
creativeId: bidResponse.hash,
currency: CURRENCY,
netRevenue: false,
ttl: TIME_TO_LIVE,
ad: bidResponse.content
});
});

return bidResponses;
Expand Down
13 changes: 11 additions & 2 deletions test/spec/modules/adliveBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,17 @@ describe('adliveBidAdapterTests', function() {
}
]
};
let bids = spec.interpretResponse(serverResponse);
let bids = spec.interpretResponse(serverResponse, bidRequestData.bids[0]);

expect(bids).to.have.lengthOf(1);

let bid = bids[0];

expect(bids).to.have.lengthOf(0);
expect(bid.creativeId).to.equal('1e100887dd614b0909bf6c49ba7f69fdd1360437');
expect(bid.ad).to.equal('Ad html passback');
expect(bid.cpm).to.equal(0);
expect(bid.width).to.equal(300);
expect(bid.height).to.equal(250);
expect(bid.currency).to.equal('USD');
});
});

0 comments on commit afdfecf

Please sign in to comment.