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 bidfloor param to allow dynamic bid floor CPM #3431

Merged
merged 3 commits into from
Jan 29, 2019
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
3 changes: 2 additions & 1 deletion integrationExamples/gpt/pbjs_example_gpt.html
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,8 @@
{
bidder: 'gumgum',
params: {
inScreen: 'ggumtest' // REQUIRED str Tracking Id
inScreen: 'ggumtest', // REQUIRED str Tracking Id
bidfloor: 0.01 // OPTIONAL number CPM bid
}
},
{
Expand Down
9 changes: 9 additions & 0 deletions modules/gumgumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ function isBidRequestValid (bid) {
utils.logWarn(`[GumGum] No product selected for the placement ${adUnitCode}, please check your implementation.`);
return false;
}

if (params.bidfloor && !(typeof params.bidfloor === 'number' && isFinite(params.bidfloor))) {
utils.logWarn('[GumGum] bidfloor must be a Number');
return false;
}

return true;
}

Expand All @@ -126,6 +132,9 @@ function buildRequests (validBidRequests, bidderRequest) {
if (pageViewId) {
data.pv = pageViewId
}
if (params.bidfloor) {
data.fp = params.bidfloor;
}
if (params.inScreen) {
data.t = params.inScreen;
data.pi = 2;
Expand Down
6 changes: 4 additions & 2 deletions modules/gumgumBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ var adUnits = [
{
bidder: 'gumgum',
params: {
inSlot: '15901' // GumGum Slot ID given to the client
inSlot: '15901', // GumGum Slot ID given to the client,
bidFloor: 0.03 // CPM bid floor
}
}
]
Expand All @@ -31,7 +32,8 @@ var adUnits = [
{
bidder: 'gumgum',
params: {
inScreen: 'dc9d6be1' // GumGum Zone ID given to the client
inScreen: 'dc9d6be1', // GumGum Zone ID given to the client
bidFloor: 0.03 // CPM bid floor
}
}
]
Expand Down
15 changes: 13 additions & 2 deletions test/spec/modules/gumgumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ describe('gumgumAdapter', function () {
let bid = {
'bidder': 'gumgum',
'params': {
'inScreen': '10433394'
'inScreen': '10433394',
'bidfloor': 0.05
},
'adUnitCode': 'adunit-code',
'sizes': [[300, 250], [300, 600], [1, 1]],
Expand All @@ -40,14 +41,24 @@ describe('gumgumAdapter', function () {
expect(spec.isBidRequestValid(bid)).to.equal(true);
});

it('should return false when required params are not passed', function () {
it('should return false when no unit type is specified', function () {
let bid = Object.assign({}, bid);
delete bid.params;
bid.params = {
'placementId': 0
};
expect(spec.isBidRequestValid(bid)).to.equal(false);
});

it('should return false when bidfloor is not a number', function () {
let bid = Object.assign({}, bid);
delete bid.params;
bid.params = {
'inSlot': '789',
'bidfloor': '0.50'
};
expect(spec.isBidRequestValid(bid)).to.equal(false);
});
});

describe('buildRequests', function () {
Expand Down