From 29c5d9bdc602144645465a4dc6c0e7d7516dfbf1 Mon Sep 17 00:00:00 2001 From: mkendall07 Date: Fri, 20 Oct 2017 17:19:21 -0400 Subject: [PATCH 1/4] add vastUrl + media type for video bids --- modules/prebidServerBidAdapter.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/modules/prebidServerBidAdapter.js b/modules/prebidServerBidAdapter.js index 0906a1a0b3d..44cfd611cb2 100644 --- a/modules/prebidServerBidAdapter.js +++ b/modules/prebidServerBidAdapter.js @@ -111,7 +111,9 @@ function PrebidServer() { if (videoMediaType) { // pbs expects a ad_unit.video attribute if the imp is video adUnit.video = Object.assign({}, videoMediaType); - delete adUnit.mediaTypes.video; + delete adUnit.mediaTypes; + // default is assumed to be 'banner' so if there is a video type we assume video only until PBS can support multi format auction. + adUnit.media_types = ['video']; } }) convertTypes(adUnits); @@ -196,10 +198,15 @@ function PrebidServer() { bidObject.creative_id = bidObj.creative_id; bidObject.bidderCode = bidObj.bidder; bidObject.cpm = cpm; - bidObject.ad = bidObj.adm; - if (bidObj.nurl) { - bidObject.ad += utils.createTrackPixelHtml(decodeURIComponent(bidObj.nurl)); + if (bidObj.media_type === 'video') { + bidObject.vastUrl = bidObj.nurl; + } else { + bidObject.ad = bidObj.adm; + if (bidObj.nurl) { + bidObject.ad += utils.createTrackPixelHtml(decodeURIComponent(bidObj.nurl)); + } } + bidObject.width = bidObj.width; bidObject.height = bidObj.height; bidObject.adserverTargeting = bidObj.ad_server_targeting; @@ -223,7 +230,6 @@ function PrebidServer() { bidObject.source = TYPE; bidObject.adUnitCode = bidRequest.placementCode; bidObject.bidderCode = bidRequest.bidder; - bidmanager.addBidResponse(bidObject.adUnitCode, bidObject); }); }); From 397c3186aeed4160f2bce80d72eb03ee4a3f1e29 Mon Sep 17 00:00:00 2001 From: mkendall07 Date: Thu, 26 Oct 2017 18:19:58 -0400 Subject: [PATCH 2/4] updates per review --- modules/prebidServerBidAdapter.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/modules/prebidServerBidAdapter.js b/modules/prebidServerBidAdapter.js index 44cfd611cb2..b88cc0ddc4f 100644 --- a/modules/prebidServerBidAdapter.js +++ b/modules/prebidServerBidAdapter.js @@ -198,12 +198,22 @@ function PrebidServer() { bidObject.creative_id = bidObj.creative_id; bidObject.bidderCode = bidObj.bidder; bidObject.cpm = cpm; + // From ORTB see section 4.2.3: adm Optional means of conveying ad markup in case the bid wins; supersedes the win notice if markup is included in both. if (bidObj.media_type === 'video') { - bidObject.vastUrl = bidObj.nurl; - } else { - bidObject.ad = bidObj.adm; + if (bidObj.adm) { + bidObject.vastXml = bidObj.adm; + } if (bidObj.nurl) { + bidObject.vastUrl = bidObj.nurl; + } + } else { + if (bidObj.adm && bidObj.nurl) { + bidObject.ad = bidObj.adm; bidObject.ad += utils.createTrackPixelHtml(decodeURIComponent(bidObj.nurl)); + } else if (bidObj.adm) { + bidObject.ad = bidObj.adm; + } else if (bidObj.nurl) { + bidObject.adUrl = bidObj.nurl } } From 2d50cc156cc253fbfa98487d59fc1b70c7f9bee6 Mon Sep 17 00:00:00 2001 From: mkendall07 Date: Thu, 26 Oct 2017 18:31:44 -0400 Subject: [PATCH 3/4] updates per review --- modules/prebidServerBidAdapter.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/prebidServerBidAdapter.js b/modules/prebidServerBidAdapter.js index b88cc0ddc4f..9f518112022 100644 --- a/modules/prebidServerBidAdapter.js +++ b/modules/prebidServerBidAdapter.js @@ -7,6 +7,7 @@ import { STATUS, S2S } from 'src/constants'; import { cookieSet } from 'src/cookie.js'; import adaptermanager from 'src/adaptermanager'; import { config } from 'src/config'; +import { VIDEO } from 'src/mediaTypes'; const getConfig = config.getConfig; @@ -199,7 +200,8 @@ function PrebidServer() { bidObject.bidderCode = bidObj.bidder; bidObject.cpm = cpm; // From ORTB see section 4.2.3: adm Optional means of conveying ad markup in case the bid wins; supersedes the win notice if markup is included in both. - if (bidObj.media_type === 'video') { + if (bidObj.media_type === VIDEO) { + bidObject.mediaType = VIDEO; if (bidObj.adm) { bidObject.vastXml = bidObj.adm; } From 4cb0162205deb9019ef24300bf6dbdd8bd754151 Mon Sep 17 00:00:00 2001 From: mkendall07 Date: Thu, 26 Oct 2017 18:49:55 -0400 Subject: [PATCH 4/4] updates per review --- modules/prebidServerBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/prebidServerBidAdapter.js b/modules/prebidServerBidAdapter.js index 9f518112022..89a59fa7c67 100644 --- a/modules/prebidServerBidAdapter.js +++ b/modules/prebidServerBidAdapter.js @@ -114,7 +114,7 @@ function PrebidServer() { adUnit.video = Object.assign({}, videoMediaType); delete adUnit.mediaTypes; // default is assumed to be 'banner' so if there is a video type we assume video only until PBS can support multi format auction. - adUnit.media_types = ['video']; + adUnit.media_types = [VIDEO]; } }) convertTypes(adUnits);