Skip to content

Commit

Permalink
Add hb_mediatype to standard targeting
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewlane committed Jan 9, 2018
1 parent 6663dbc commit e6520b3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
8 changes: 7 additions & 1 deletion src/auction.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,13 @@ export function getStandardBidderSettings() {
val: function (bidResponse) {
return bidResponse.source;
}
}
},
{
key: 'hb_mediatype',
val: function (bidResponse) {
return bidResponse.mediaType;
}
},
]
}
return bidder_settings[CONSTANTS.JSON_MAPPING.BD_SETTING_STANDARD];
Expand Down
3 changes: 2 additions & 1 deletion src/constants.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"hb_pb",
"hb_size",
"hb_deal",
"hb_source"
"hb_source",
"hb_mediatype"
],
"S2S" : {
"SRC" : "s2s",
Expand Down
25 changes: 19 additions & 6 deletions test/spec/auctionmanager_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ describe('auctionmanager.js', function () {
var size = '300x250';
var adId = '1adId';
var source = 'client';
var mediatype = 'banner';

before(function () {
bid.cpm = bidPriceCpm;
Expand All @@ -52,6 +53,7 @@ describe('auctionmanager.js', function () {
bid.bidderCode = bidderCode;
bid.adId = adId;
bid.source = source;
bid.mediaType = mediatype;
});

it('No bidder level configuration defined - default', function () {
Expand All @@ -60,7 +62,8 @@ describe('auctionmanager.js', function () {
'hb_adid': adId,
'hb_pb': bidPbMg,
'hb_size': size,
'hb_source': source
'hb_source': source,
'hb_mediatype': mediatype,
};
var response = getKeyValueTargetingPairs(bidderCode, bid, CONSTANTS.GRANULARITY_OPTIONS.MEDIUM);
assert.deepEqual(response, expected);
Expand Down Expand Up @@ -98,7 +101,13 @@ describe('auctionmanager.js', function () {
val: function (bidResponse) {
return bidResponse.source;
}
}
},
{
key: 'hb_mediatype',
val: function (bidResponse) {
return bidResponse.mediaType;
}
},
]

}
Expand All @@ -109,7 +118,8 @@ describe('auctionmanager.js', function () {
'hb_adid': adId,
'hb_pb': bidPbHg,
'hb_size': size,
'hb_source': source
'hb_source': source,
'hb_mediatype': mediatype,
};
var response = getKeyValueTargetingPairs(bidderCode, bid, CONSTANTS.GRANULARITY_OPTIONS.MEDIUM);
assert.deepEqual(response, expected);
Expand Down Expand Up @@ -152,7 +162,8 @@ describe('auctionmanager.js', function () {
'hb_adid': adId,
'hb_pb': bidPbHg,
'hb_size': size,
'hb_source': source
'hb_source': source,
'hb_mediatype': mediatype,
};
var response = getKeyValueTargetingPairs(bidderCode, bid);
assert.deepEqual(response, expected);
Expand Down Expand Up @@ -195,7 +206,8 @@ describe('auctionmanager.js', function () {
'hb_adid': adId,
'hb_pb': bidPbMg,
'hb_size': size,
'hb_source': source
'hb_source': source,
'hb_mediatype': mediatype,
};
var response = getKeyValueTargetingPairs(bidderCode, bid, CONSTANTS.GRANULARITY_OPTIONS.MEDIUM);
assert.deepEqual(response, expected);
Expand Down Expand Up @@ -360,7 +372,8 @@ describe('auctionmanager.js', function () {
'hb_adid': adId,
'hb_pb': 5.57,
'hb_size': '300x250',
'hb_source': source
'hb_source': source,
'hb_mediatype': mediatype,
};
var response = getKeyValueTargetingPairs(bidderCode, bid);
assert.deepEqual(response, expected);
Expand Down

0 comments on commit e6520b3

Please sign in to comment.