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

added hb_source to default keys #1969

Merged
merged 3 commits into from
Dec 19, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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/auction.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,12 @@ export function getStandardBidderSettings() {
val: function (bidResponse) {
return bidResponse.dealId;
}
},
{
key: 'hb_source',
val: function (bidResponse) {
return bidResponse.source;
}
}
]
}
Expand Down
2 changes: 2 additions & 0 deletions src/bidfactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var utils = require('./utils.js');
*/
function Bid(statusCode, bidRequest) {
var _bidId = (bidRequest && bidRequest.bidId) || utils.getUniqueIdentifierStr();
var _bidSrc = (bidRequest && bidRequest.src) || 'client';
var _statusCode = statusCode || 0;

this.bidderCode = (bidRequest && bidRequest.bidder) || '';
Expand All @@ -24,6 +25,7 @@ function Bid(statusCode, bidRequest) {
this.statusMessage = _getStatus();
this.adId = _bidId;
this.mediaType = 'banner';
this.source = _bidSrc;

function _getStatus() {
switch (_statusCode) {
Expand Down
3 changes: 2 additions & 1 deletion src/constants.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
"hb_adid",
"hb_pb",
"hb_size",
"hb_deal"
"hb_deal",
"hb_source"
],
"S2S" : {
"SRC" : "s2s",
Expand Down
23 changes: 18 additions & 5 deletions test/spec/auctionmanager_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('auctionmanager.js', function () {
var bidderCode = 'appnexus';
var size = '300x250';
var adId = '1adId';
var source = 'client';

before(function () {
bid.cpm = bidPriceCpm;
Expand All @@ -50,14 +51,16 @@ describe('auctionmanager.js', function () {
};
bid.bidderCode = bidderCode;
bid.adId = adId;
bid.source = source;
});

it('No bidder level configuration defined - default', function () {
var expected = {
'hb_bidder': bidderCode,
'hb_adid': adId,
'hb_pb': bidPbMg,
'hb_size': size
'hb_size': size,
'hb_source': source
};
var response = getKeyValueTargetingPairs(bidderCode, bid, CONSTANTS.GRANULARITY_OPTIONS.MEDIUM);
assert.deepEqual(response, expected);
Expand Down Expand Up @@ -89,6 +92,12 @@ describe('auctionmanager.js', function () {
val: function (bidResponse) {
return bidResponse.size;
}
},
{
key: 'hb_source',
val: function (bidResponse) {
return bidResponse.source;
}
}
]

Expand All @@ -99,7 +108,8 @@ describe('auctionmanager.js', function () {
'hb_bidder': bidderCode,
'hb_adid': adId,
'hb_pb': bidPbHg,
'hb_size': size
'hb_size': size,
'hb_source': source
};
var response = getKeyValueTargetingPairs(bidderCode, bid, CONSTANTS.GRANULARITY_OPTIONS.MEDIUM);
assert.deepEqual(response, expected);
Expand Down Expand Up @@ -141,7 +151,8 @@ describe('auctionmanager.js', function () {
'hb_bidder': bidderCode,
'hb_adid': adId,
'hb_pb': bidPbHg,
'hb_size': size
'hb_size': size,
'hb_source': source
};
var response = getKeyValueTargetingPairs(bidderCode, bid);
assert.deepEqual(response, expected);
Expand Down Expand Up @@ -183,7 +194,8 @@ describe('auctionmanager.js', function () {
'hb_bidder': bidderCode,
'hb_adid': adId,
'hb_pb': bidPbMg,
'hb_size': size
'hb_size': size,
'hb_source': source
};
var response = getKeyValueTargetingPairs(bidderCode, bid, CONSTANTS.GRANULARITY_OPTIONS.MEDIUM);
assert.deepEqual(response, expected);
Expand Down Expand Up @@ -347,7 +359,8 @@ describe('auctionmanager.js', function () {
'hb_bidder': bidderCode,
'hb_adid': adId,
'hb_pb': 5.57,
'hb_size': '300x250'
'hb_size': '300x250',
'hb_source': source
};
var response = getKeyValueTargetingPairs(bidderCode, bid);
assert.deepEqual(response, expected);
Expand Down