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

add vastUrl + media type for video bids Prebid Server #1739

Merged
merged 4 commits into from
Oct 27, 2017
Merged
Changes from all commits
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
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