Skip to content

Commit

Permalink
add vastUrl + media type for video bids Prebid Server (#1739)
Browse files Browse the repository at this point in the history
* add vastUrl + media type for video bids

* updates per review

* updates per review

* updates per review
  • Loading branch information
Matt Kendall authored and dbemiller committed Oct 27, 2017
1 parent d5f1cd1 commit c2dd4c7
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions modules/prebidServerBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -111,7 +112,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);
Expand Down Expand Up @@ -196,10 +199,26 @@ 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));
// 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.mediaType = VIDEO;
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
}
}

bidObject.width = bidObj.width;
bidObject.height = bidObj.height;
bidObject.adserverTargeting = bidObj.ad_server_targeting;
Expand All @@ -223,7 +242,6 @@ function PrebidServer() {
bidObject.source = TYPE;
bidObject.adUnitCode = bidRequest.placementCode;
bidObject.bidderCode = bidRequest.bidder;

bidmanager.addBidResponse(bidObject.adUnitCode, bidObject);
});
});
Expand Down

0 comments on commit c2dd4c7

Please sign in to comment.