Skip to content

Commit

Permalink
Merge branch 'master' into prebid-3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Fawke committed Oct 1, 2019
2 parents 06c6fbd + 696f1e9 commit 8855c1e
Show file tree
Hide file tree
Showing 63 changed files with 5,153 additions and 760 deletions.
3 changes: 2 additions & 1 deletion integrationExamples/gpt/userId_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@
expires: 60
}
}],
syncDelay: 5000
syncDelay: 5000,
auctionDelay: 1000
}
});
pbjs.addAdUnits(adUnits);
Expand Down
2 changes: 1 addition & 1 deletion modules/adkernelBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const VERSION = '1.3';
export const spec = {

code: 'adkernel',
aliases: ['headbidding', 'adsolut', 'oftmediahb'],
aliases: ['headbidding', 'adsolut', 'oftmediahb', 'audiencemedia'],
supportedMediaTypes: [BANNER, VIDEO],
isBidRequestValid: function(bidRequest) {
return 'params' in bidRequest &&
Expand Down
4 changes: 3 additions & 1 deletion modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,16 @@ export const spec = {

const memberIdBid = find(bidRequests, hasMemberId);
const member = memberIdBid ? parseInt(memberIdBid.params.member, 10) : 0;
const schain = bidRequests[0].schain;

const payload = {
tags: [...tags],
user: userObj,
sdk: {
source: SOURCE,
version: '$prebid.version$'
}
},
schain: schain
};

if (member > 0) {
Expand Down
5 changes: 2 additions & 3 deletions modules/conversantBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { BANNER, VIDEO } from '../src/mediaTypes';

const BIDDER_CODE = 'conversant';
const URL = '//web.hb.ad.cpe.dotomi.com/s2s/header/24';
const VERSION = '2.2.4';

export const spec = {
code: BIDDER_CODE,
Expand All @@ -24,7 +23,7 @@ export const spec = {
}

if (!utils.isStr(bid.params.site_id)) {
utils.logWarn(BIDDER_CODE + ': site_id must be specified as a string')
utils.logWarn(BIDDER_CODE + ': site_id must be specified as a string');
return false;
}

Expand Down Expand Up @@ -67,7 +66,7 @@ export const spec = {
secure: secure,
bidfloor: bidfloor || 0,
displaymanager: 'Prebid.js',
displaymanagerver: VERSION
displaymanagerver: '$prebid.version$'
};

copyOptProperty(bid.params.tag_id, imp, 'tagid');
Expand Down
4 changes: 2 additions & 2 deletions modules/criteoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import find from 'core-js/library/fn/array/find';
import JSEncrypt from 'jsencrypt/bin/jsencrypt';
import sha256 from 'crypto-js/sha256';

export const ADAPTER_VERSION = 20;
export const ADAPTER_VERSION = 21;
const BIDDER_CODE = 'criteo';
const CDB_ENDPOINT = '//bidder.criteo.com/cdb';
const CDB_ENDPOINT = 'https://bidder.criteo.com/cdb';
const CRITEO_VENDOR_ID = 91;
const PROFILE_ID_INLINE = 207;
export const PROFILE_ID_PUBLISHERTAG = 185;
Expand Down
9 changes: 5 additions & 4 deletions modules/criteortusIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const criteortusIdSubmodule = {
* performs action to obtain id and return a value in the callback's response argument
* @function
* @param {SubmoduleParams} [configParams]
* @returns {function(callback:function)}
* @returns {IdResponse|undefined}
*/
getId(configParams) {
if (!configParams || !utils.isPlainObject(configParams.clientIdentifier)) {
Expand All @@ -46,10 +46,10 @@ export const criteortusIdSubmodule = {

let uid = utils.getCookie(key);
if (uid) {
return uid;
return {id: uid};
} else {
let userIds = {};
return function(callback) {
const resp = function(callback) {
let bidders = Object.keys(configParams.clientIdentifier);

function afterAllResponses() {
Expand Down Expand Up @@ -97,7 +97,8 @@ export const criteortusIdSubmodule = {
})
);
})
}
};
return {callback: resp};
}
}
};
Expand Down
54 changes: 50 additions & 4 deletions modules/datablocksBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as utils from '../src/utils';
import { registerBidder } from '../src/adapters/bidderFactory';
import { BANNER, NATIVE } from '../src/mediaTypes';
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes';
import { parse as parseUrl } from '../src/url';
const NATIVE_MAP = {
'body': 2,
Expand Down Expand Up @@ -43,12 +43,17 @@ const NATIVE_IMAGE = [{
}
}];

const VIDEO_PARAMS = ['mimes', 'minduration', 'maxduration', 'protocols', 'w', 'h', 'startdelay',
'placement', 'linearity', 'skip', 'skipmin', 'skipafter', 'sequence', 'battr', 'maxextended',
'minbitrate', 'maxbitrate', 'boxingallowed', 'playbackmethod', 'playbackend', 'delivery',
'pos', 'companionad', 'api', 'companiontype', 'ext'];

export const spec = {
supportedMediaTypes: [BANNER, NATIVE],
supportedMediaTypes: [BANNER, NATIVE, VIDEO],
code: 'datablocks',
isBidRequestValid: function(bid) {
return !!(bid.params.host && bid.params.sourceId &&
bid.mediaTypes && (bid.mediaTypes.banner || bid.mediaTypes.native));
bid.mediaTypes && (bid.mediaTypes.banner || bid.mediaTypes.native || bid.mediaTypes.video));
},
buildRequests: function(validBidRequests, bidderRequest) {
if (!validBidRequests.length) { return []; }
Expand Down Expand Up @@ -142,6 +147,43 @@ export const spec = {
request: JSON.stringify({native: {assets: nativeAssets}})
};
}
} else if (utils.deepAccess(bidRequest, 'mediaTypes.video')) {
let video = bidRequest.mediaTypes.video;
let sizes = video.playerSize || bidRequest.sizes || [];
if (sizes.length && Array.isArray(sizes[0])) {
imp.video = {
w: sizes[0][0],
h: sizes[0][1]
};
} else if (sizes.length == 2 && !Array.isArray(sizes[0])) {
imp.video = {
w: sizes[0],
h: sizes[1]
};
} else {
return;
}

if (video.durationRangeSec) {
if (Array.isArray(video.durationRangeSec)) {
if (video.durationRangeSec.length == 1) {
imp.video.maxduration = video.durationRangeSec[0];
} else if (video.durationRangeSec.length == 2) {
imp.video.minduration = video.durationRangeSec[0];
imp.video.maxduration = video.durationRangeSec[1];
}
} else {
imp.video.maxduration = video.durationRangeSec;
}
}

if (bidRequest.params.video) {
Object.keys(bidRequest.params.video).forEach(k => {
if (VIDEO_PARAMS.indexOf(k) > -1) {
imp.video[k] = bidRequest.params.video[k];
}
})
}
}
let host = bidRequest.params.host;
let sourceId = bidRequest.params.sourceId;
Expand Down Expand Up @@ -181,7 +223,6 @@ export const spec = {
}
})
});

return requests;

function RtbRequest(device, site, imps) {
Expand Down Expand Up @@ -276,6 +317,11 @@ export const spec = {
}
})
br.native = result;
} else if (imp.video) {
br.mediaType = VIDEO;
br.width = rtbBid.w;
br.height = rtbBid.h;
if (rtbBid.adm) { br.vastXml = rtbBid.adm; } else if (rtbBid.nurl) { br.vastUrl = rtbBid.nurl; }
}
return br;
});
Expand Down
21 changes: 20 additions & 1 deletion modules/datablocksBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Maintainer: support@datablocks.net
# Description

Connects to Datablocks Version 5 Platform
Banner Native and
Banner Native and Video


# Test Parameters
Expand Down Expand Up @@ -47,6 +47,25 @@ Banner Native and
sourceId: 12345,
host: 'prebid.datablocks.net'
}
}, {
code: 'video-div',
mediaTypes : {
video: {
playerSize:[500,400],
durationRangeSec:[15,30],
context: "linear"
}
},
bids: [
{
bidder: 'datablocks',
params: {
sourceId: 12345,
host: 'prebid.datablocks.net',
video: {
mimes:["video/flv"]
}
}
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions modules/dfpAdServerVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export function buildDfpVideoUrl(options) {

return buildUrl({
protocol: 'https',
host: 'pubads.g.doubleclick.net',
host: 'securepubads.g.doubleclick.net',
pathname: '/gampad/ads',
search: queryParams
});
Expand Down Expand Up @@ -184,7 +184,7 @@ export function buildAdpodVideoUrl({code, params, callback} = {}) {

const masterTag = buildUrl({
protocol: 'https',
host: 'pubads.g.doubleclick.net',
host: 'securepubads.g.doubleclick.net',
pathname: '/gampad/ads',
search: queryParams
});
Expand Down
4 changes: 3 additions & 1 deletion modules/digiTrustIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,9 @@ export const digiTrustIdSubmodule = {
utils.logError('DigiTrust ID submodule decode error');
}
},
getId: getDigiTrustId,
getId: function (configParams) {
return {callback: getDigiTrustId(configParams)};
},
_testInit: surfaceTestHook
};

Expand Down
129 changes: 129 additions & 0 deletions modules/djaxBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
import { registerBidder } from '../src/adapters/bidderFactory';
import { config } from '../src/config';
import * as utils from '../src/utils';
import {BANNER, VIDEO} from '../src/mediaTypes';
import { ajax } from '../src/ajax';
import {Renderer} from '../src/Renderer';

const SUPPORTED_AD_TYPES = [BANNER, VIDEO];
const BIDDER_CODE = 'djax';
const DOMAIN = 'https://demo.reviveadservermod.com/headerbidding_adminshare/';
const RENDERER_URL = '//acdn.adnxs.com/video/outstream/ANOutstreamVideo.js';

function isBidRequestValid(bid) {
return (typeof bid.params !== 'undefined' && parseInt(utils.getValue(bid.params, 'publisherId')) > 0);
}

function buildRequests(validBidRequests) {
return {
method: 'POST',
url: DOMAIN + 'www/admin/plugins/Prebid/getAd.php',
options: {
withCredentials: false,
crossOrigin: true
},
data: validBidRequests,
};
}

function interpretResponse(serverResponse, request) {
const response = serverResponse.body;
const bidResponses = [];
var bidRequestResponses = [];

utils._each(response, function(bidAd) {
bidAd.adResponse = {
content: bidAd.vastXml,
height: bidAd.height,
width: bidAd.width
};
bidAd.ttl = config.getConfig('_bidderTimeout')
bidAd.renderer = bidAd.context === 'outstream' ? createRenderer(bidAd, {
id: bidAd.adUnitCode,
url: RENDERER_URL
}, bidAd.adUnitCode) : undefined;
bidResponses.push(bidAd);
});

bidRequestResponses.push({
function: 'saveResponses',
request: request,
response: bidResponses
});
sendResponseToServer(bidRequestResponses);
return bidResponses;
}

function outstreamRender(bidAd) {
bidAd.renderer.push(() => {
window.ANOutstreamVideo.renderAd({
sizes: [bidAd.width, bidAd.height],
width: bidAd.width,
height: bidAd.height,
targetId: bidAd.adUnitCode,
adResponse: bidAd.adResponse,
rendererOptions: {
showVolume: false,
allowFullscreen: false
}
});
});
}

function createRenderer(bidAd, rendererParams, adUnitCode) {
const renderer = Renderer.install({
id: rendererParams.id,
url: rendererParams.url,
loaded: false,
config: {'player_height': bidAd.height, 'player_width': bidAd.width},
adUnitCode
});
try {
renderer.setRender(outstreamRender);
} catch (err) {
utils.logWarn('Prebid Error calling setRender on renderer', err);
}
return renderer;
}

function onBidWon(bid) {
let wonBids = [];
wonBids.push(bid);
wonBids[0].function = 'onBidWon';
sendResponseToServer(wonBids);
}

function onTimeout(details) {
details.unshift({ 'function': 'onTimeout' });
sendResponseToServer(details);
}

function sendResponseToServer(data) {
ajax(DOMAIN + 'www/admin/plugins/Prebid/tracking/track.php', null, JSON.stringify(data), {
withCredentials: false,
method: 'POST',
crossOrigin: true
});
}

function getUserSyncs(syncOptions) {
if (syncOptions.iframeEnabled) {
return [{
type: 'iframe',
url: DOMAIN + 'www/admin/plugins/Prebid/userSync.php'
}];
}
}

export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: SUPPORTED_AD_TYPES,
isBidRequestValid,
buildRequests,
interpretResponse,
getUserSyncs,
onBidWon,
onTimeout
};

registerBidder(spec);
Loading

0 comments on commit 8855c1e

Please sign in to comment.