Skip to content

Commit

Permalink
Add bidfloor param
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamoris committed Oct 30, 2018
1 parent 1288119 commit 0bc553a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
9 changes: 8 additions & 1 deletion modules/rtbhouseBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,19 @@ registerBidder(spec);
* @returns {object} Imp by OpenRTB 2.5 §3.2.4
*/
function mapImpression(slot) {
return {
const imp = {
id: slot.bidId,
banner: mapBanner(slot),
native: mapNative(slot),
tagid: slot.adUnitCode.toString()
};

const bidfloor = parseFloat(slot.params.bidfloor);
if (bidfloor) {
imp.bidfloor = bidfloor
}

return imp;
}

/**
Expand Down
6 changes: 4 additions & 2 deletions modules/rtbhouseBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Maintainer: prebid@rtbhouse.com
# Description

Connects to RTB House unique demand.
Banner formats are supported.
Banner and native formats are supported.
Unique publisherId is required.
Please reach out to pmp@rtbhouse.com to receive your own

Expand All @@ -23,7 +23,8 @@ Please reach out to pmp@rtbhouse.com to receive your own
bidder: "rtbhouse",
params: {
region: 'prebid-eu',
publisherId: 'PREBID_TEST_ID'
publisherId: 'PREBID_TEST_ID',
bidfloor: 0.01 // optional
}
}
]
Expand All @@ -50,6 +51,7 @@ Please reach out to pmp@rtbhouse.com to receive your own
params: {
region: 'prebid-eu',
publisherId: 'PREBID_TEST_ID'
bidfloor: 0.01 // optional
}
}
]
Expand Down
8 changes: 8 additions & 0 deletions test/spec/modules/rtbhouseBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ describe('RTBHouseAdapter', () => {
expect(data.source.tid).to.equal('example-transaction-id');
});

it('should include bidfloor in request if available', () => {
const bidRequest = Object.assign([], bidRequests);
bidRequest[0].params.bidfloor = 0.01;
const request = spec.buildRequests(bidRequest);
const data = JSON.parse(request.data);
expect(data.imp[0].bidfloor).to.equal(0.01)
});

describe('native imp', () => {
function basicRequest(extension) {
return Object.assign({
Expand Down

0 comments on commit 0bc553a

Please sign in to comment.