Skip to content

Commit

Permalink
grid Bid Adapter: Fix empty bidfloor (#6031)
Browse files Browse the repository at this point in the history
* Added TheMediaGridNM Bid Adapter

* Updated required params for TheMediaGridNM Bid Adapter

* Update TheMediGridNM Bid Adapter

* Fix tests for TheMediaGridNM Bid Adapter

* Fixes after review for TheMediaGridNM Bid Adapter

* Add support of multi-format in TheMediaGrid Bid Adapter

* Update sync url for grid and gridNM Bid Adapters

* TheMediaGrid Bid Adapter: added keywords adUnit parameter

* Update TheMediaGrid Bid Adapter to support keywords from config

* Implement new request format for TheMediaGrid Bid Adapter

* Fix jwpseg params for TheMediaGrid Bid Adapter

* Update unit tests for The Media Grid Bid Adapter

* Fix typo in TheMediaGrid Bid Adapter

* Added test for jwTargeting in TheMediaGrid Bid Adapter

* The new request format was made by default in TheMediaGrid Bid Adapter

* Update userId format in ad request for TheMediaGrid Bid Adapter

* Added bidFloor parameter for TheMediaGrid Bid Adapter

* Fix for review TheMediaGrid Bid Adapter

* Support floorModule in TheMediaGrid Bid Adapter

* Fix empty bidfloor for TheMediaGrid Bid Adapter

* Some change to restart autotests
  • Loading branch information
TheMediaGrid authored Dec 1, 2020
1 parent 2609a1b commit 6963bb3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
15 changes: 9 additions & 6 deletions modules/gridBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ export const spec = {
if (!userId) {
userId = bid.userId;
}
const {params: {uid, keywords, bidFloor}, mediaTypes, bidId, adUnitCode, rtd} = bid;
const {params: {uid, keywords}, mediaTypes, bidId, adUnitCode, rtd} = bid;
bidsMap[bidId] = bid;
if (!pageKeywords && !utils.isEmpty(keywords)) {
pageKeywords = utils.transformBidderParamKeywords(keywords);
}
const bidFloor = _getFloor(mediaTypes || {}, bid);
const jwTargeting = rtd && rtd.jwplayer && rtd.jwplayer.targeting;
if (jwTargeting) {
if (!jwpseg && jwTargeting.segments) {
Expand All @@ -91,10 +92,13 @@ export const spec = {
tagid: uid.toString(),
ext: {
divid: adUnitCode
},
bidfloor: _getFloor(mediaTypes || {}, bidFloor, bid)
}
};

if (bidFloor) {
impObj.bidfloor = bidFloor;
}

if (!mediaTypes || mediaTypes[BANNER]) {
const banner = createBannerRequest(bid, mediaTypes ? mediaTypes[BANNER] : {});
if (banner) {
Expand Down Expand Up @@ -323,13 +327,12 @@ export const spec = {
/**
* Gets bidfloor
* @param {Object} mediaTypes
* @param {Number} bidfloor
* @param {Object} bid
* @returns {Number} floor
*/
function _getFloor (mediaTypes, bidfloor, bid) {
function _getFloor (mediaTypes, bid) {
const curMediaType = mediaTypes.video ? 'video' : 'banner';
let floor = bidfloor || 0;
let floor = bid.params.bidFloor || 0;

if (typeof bid.getFloor === 'function') {
const floorInfo = bid.getFloor({
Expand Down
8 changes: 1 addition & 7 deletions test/spec/modules/gridBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ describe('TheMediaGrid Adapter', function () {
'id': bidRequests[1].bidId,
'tagid': bidRequests[1].params.uid,
'ext': {'divid': bidRequests[1].adUnitCode},
'bidfloor': 0,
'banner': {
'w': 300,
'h': 250,
Expand Down Expand Up @@ -211,7 +210,6 @@ describe('TheMediaGrid Adapter', function () {
'id': bidRequests[1].bidId,
'tagid': bidRequests[1].params.uid,
'ext': {'divid': bidRequests[1].adUnitCode},
'bidfloor': 0,
'banner': {
'w': 300,
'h': 250,
Expand All @@ -221,7 +219,6 @@ describe('TheMediaGrid Adapter', function () {
'id': bidRequests[2].bidId,
'tagid': bidRequests[2].params.uid,
'ext': {'divid': bidRequests[2].adUnitCode},
'bidfloor': 0,
'video': {
'w': 400,
'h': 600,
Expand Down Expand Up @@ -259,7 +256,6 @@ describe('TheMediaGrid Adapter', function () {
'id': bidRequests[1].bidId,
'tagid': bidRequests[1].params.uid,
'ext': {'divid': bidRequests[1].adUnitCode},
'bidfloor': 0,
'banner': {
'w': 300,
'h': 250,
Expand All @@ -269,7 +265,6 @@ describe('TheMediaGrid Adapter', function () {
'id': bidRequests[2].bidId,
'tagid': bidRequests[2].params.uid,
'ext': {'divid': bidRequests[2].adUnitCode},
'bidfloor': 0,
'video': {
'w': 400,
'h': 600,
Expand All @@ -279,7 +274,6 @@ describe('TheMediaGrid Adapter', function () {
'id': bidRequests[3].bidId,
'tagid': bidRequests[3].params.uid,
'ext': {'divid': bidRequests[3].adUnitCode},
'bidfloor': 0,
'banner': {
'w': 728,
'h': 90,
Expand Down Expand Up @@ -460,7 +454,7 @@ describe('TheMediaGrid Adapter', function () {
'floor': 1.50
};
const bidRequest = Object.assign({
getFloor: _ => {
getFloor: (_) => {
return floorTestData;
}
}, bidRequests[1]);
Expand Down

0 comments on commit 6963bb3

Please sign in to comment.