Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/parrableIdSystem/PBID-96_request…
Browse files Browse the repository at this point in the history
…FilterStatus' into PBID-96_requestFilterStatus

* origin/parrableIdSystem/PBID-96_requestFilterStatus: (63 commits)
  Smaato bid adapter: Rework multi imp support (prebid#6814)
  Adot Bid Adapter: add the advertising domains support (prebid#6876)
  Update Adtelligent, Adtarget, ViewDeos   adapters to support adomain (prebid#6917)
  LockerDome Bid Adapter: support for meta.advertiserDomains  (prebid#6921)
  Sublime Bid Adapter : Add support for meta.advertiserDomains (prebid#6920)
  Brightcom Bid Adapter: use getFloor function (prebid#6918)
  AdYouLike Bidder: Handle advertiser domains (prebid#6916)
  relaido Bid Adapter: Add meta OBJ to BidResponse (prebid#6914)
  Jixie Bid Adapter: add support for advertiserDomains (prebid#6898)
  Onomagic Bid Adapter: use getFloor function (prebid#6907)
  Sharethrough Bid Adapter: Use getFloor module for Prebid 5.0 compliance (prebid#6874)
  Accept outstream renderers defined in mediatype for PBS (prebid#6896)
  Yieldmo Bid Adapter: read video parameters from the ad unit (prebid#6873)
  smartx Bid Adapter: Add support for Floors Module (prebid#6902)
  add support for advertiser domains (prebid#6908)
  Onomagic Bid Adapter: handle meta.advertiserDomains (prebid#6906)
  Brightcom Bid Adapter: handle meta.advertiserDomains (prebid#6905)
  ucfunnel Bid Adapter: add support Price Floors Module (prebid#6806)
  eTarget Bid Adapter: add "getMetaData" function to adapter, support for advertiserDomains  (prebid#6901)
  AdagioBidAdapter: support priceFloors module (prebid#6867)
  ...
  • Loading branch information
Álvaro Brey Vilas committed Jun 2, 2021
2 parents 1536cc4 + b04d212 commit 353a3d8
Show file tree
Hide file tree
Showing 122 changed files with 4,161 additions and 1,632 deletions.
1 change: 1 addition & 0 deletions integrationExamples/gpt/idImportLibrary_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
params: {
pid: '14', // Set your real identityLink placement ID here
// notUse3P: true // true/false - If you do not want to use 3P endpoint to retrieve envelope. If you do not set this property to true, 3p endpoint will be fired. By default this propertt is undefined and 3p request will be fired.},
},
storage: {
type: 'html5',
name: 'idl_env',
Expand Down
5 changes: 4 additions & 1 deletion modules/a4gBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ export const spec = {
currency: A4G_CURRENCY,
netRevenue: true,
ttl: A4G_TTL,
ad: response.ad
ad: response.ad,
meta: {
advertiserDomains: response.adomain && response.adomain.length > 0 ? response.adomain : []
}
};
bidResponses.push(bidResponse);
}
Expand Down
4 changes: 4 additions & 0 deletions modules/adWMGBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ export const spec = {
netRevenue: response.netRevenue,
ttl: response.ttl,
ad: response.ad,
meta: {
advertiserDomains: response.adomain && response.adomain.length ? response.adomain : [],
mediaType: 'banner'
}
};
bidResponses.push(bidResponse);
}
Expand Down
57 changes: 54 additions & 3 deletions modules/adagioBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export const RENDERER_URL = 'https://script.4dex.io/outstream-player.js';
const MAX_SESS_DURATION = 30 * 60 * 1000;
const ADAGIO_PUBKEY = 'AL16XT44Sfp+8SHVF1UdC7hydPSMVLMhsYknKDdwqq+0ToDSJrP0+Qh0ki9JJI2uYm/6VEYo8TJED9WfMkiJ4vf02CW3RvSWwc35bif2SK1L8Nn/GfFYr/2/GG/Rm0vUsv+vBHky6nuuYls20Og0HDhMgaOlXoQ/cxMuiy5QSktp';
const ADAGIO_PUBKEY_E = 65537;
const CURRENCY = 'USD';
const DEFAULT_FLOOR = 0.1;

// This provide a whitelist and a basic validation
// of OpenRTB 2.5 options used by the Adagio SSP.
Expand Down Expand Up @@ -819,6 +821,48 @@ function _parseNativeBidResponse(bid) {
bid.native = native
}

function _getFloors(bidRequest) {
if (!utils.isFn(bidRequest.getFloor)) {
return false;
}

const floors = [];

const getAndPush = (mediaType, size) => {
const info = bidRequest.getFloor({
currency: CURRENCY,
mediaType,
size: []
});

floors.push(utils.cleanObj({
mt: mediaType,
s: utils.isArray(size) ? `${size[0]}x${size[1]}` : undefined,
f: (!isNaN(info.floor) && info.currency === CURRENCY) ? info.floor : DEFAULT_FLOOR
}));
}

Object.keys(bidRequest.mediaTypes).forEach(mediaType => {
if (SUPPORTED_MEDIA_TYPES.indexOf(mediaType) !== -1) {
const sizeProp = mediaType === VIDEO ? 'playerSize' : 'sizes';

if (bidRequest.mediaTypes[mediaType][sizeProp] && bidRequest.mediaTypes[mediaType][sizeProp].length) {
if (utils.isArray(bidRequest.mediaTypes[mediaType][sizeProp][0])) {
bidRequest.mediaTypes[mediaType][sizeProp].forEach(size => {
getAndPush(mediaType, [size[0], size[1]]);
});
} else {
getAndPush(mediaType, [bidRequest.mediaTypes[mediaType][sizeProp][0], bidRequest.mediaTypes[mediaType][sizeProp][1]]);
}
} else {
getAndPush(mediaType, '*');
}
}
});

return floors;
}

export const spec = {
code: BIDDER_CODE,
gvlid: GVLID,
Expand Down Expand Up @@ -914,6 +958,9 @@ export const spec = {
const adUnits = utils._map(validBidRequests, (bidRequest) => {
bidRequest.features = internal.getFeatures(bidRequest, bidderRequest);

// Handle priceFloors module
bidRequest.floors = _getFloors(bidRequest);

if (utils.deepAccess(bidRequest, 'mediaTypes.video')) {
_buildVideoBidRequest(bidRequest);
}
Expand All @@ -923,10 +970,14 @@ export const spec = {

// Group ad units by organizationId
const groupedAdUnits = adUnits.reduce((groupedAdUnits, adUnit) => {
adUnit.params.organizationId = adUnit.params.organizationId.toString();
const adUnitCopy = utils.deepClone(adUnit);
adUnitCopy.params.organizationId = adUnitCopy.params.organizationId.toString();

// remove useless props
delete adUnitCopy.floorData;

groupedAdUnits[adUnit.params.organizationId] = groupedAdUnits[adUnit.params.organizationId] || [];
groupedAdUnits[adUnit.params.organizationId].push(adUnit);
groupedAdUnits[adUnitCopy.params.organizationId] = groupedAdUnits[adUnitCopy.params.organizationId] || [];
groupedAdUnits[adUnitCopy.params.organizationId].push(adUnitCopy);

return groupedAdUnits;
}, {});
Expand Down
30 changes: 28 additions & 2 deletions modules/adkernelAdnBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,49 @@ function buildBid(tag) {
requestId: tag.impid,
bidderCode: spec.code,
cpm: tag.bid,
width: tag.w,
height: tag.h,
creativeId: tag.crid,
currency: 'USD',
ttl: 720,
netRevenue: true
};
if (tag.w) {
bid.width = tag.w;
}
if (tag.h) {
bid.height = tag.h;
}
if (tag.tag) {
bid.ad = tag.tag;
bid.mediaType = BANNER;
} else if (tag.vast_url) {
bid.vastUrl = tag.vast_url;
bid.mediaType = VIDEO;
}
fillBidMeta(bid, tag);
return bid;
}

function fillBidMeta(bid, tag) {
if (utils.isStr(tag.agencyName)) {
utils.deepSetValue(bid, 'meta.agencyName', tag.agencyName);
}
if (utils.isNumber(tag.advertiserId)) {
utils.deepSetValue(bid, 'meta.advertiserId', tag.advertiserId);
}
if (utils.isStr(tag.advertiserName)) {
utils.deepSetValue(bid, 'meta.advertiserName', tag.advertiserName);
}
if (utils.isArray(tag.advertiserDomains)) {
utils.deepSetValue(bid, 'meta.advertiserDomains', tag.advertiserDomains);
}
if (utils.isStr(tag.primaryCatId)) {
utils.deepSetValue(bid, 'meta.primaryCatId', tag.primaryCatId);
}
if (utils.isArray(tag.secondaryCatIds)) {
utils.deepSetValue(bid, 'meta.secondaryCatIds', tag.secondaryCatIds);
}
}

function getBidFloor(bid, mediaType, sizes) {
var floor;
var size = sizes.length === 1 ? sizes[0] : '*';
Expand Down
3 changes: 2 additions & 1 deletion modules/adkernelBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ export const spec = {
{code: 'bcm'},
{code: 'engageadx'},
{code: 'converge_digital', gvlid: 248},
{code: 'adomega'}
{code: 'adomega'},
{code: 'denakop'}
],
supportedMediaTypes: [BANNER, VIDEO, NATIVE],

Expand Down
5 changes: 4 additions & 1 deletion modules/adoceanBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ function interpretResponse(placementResponse, bidRequest, bids) {
width: parseInt(placementResponse.width, 10),
netRevenue: false,
ttl: parseInt(placementResponse.ttl),
creativeId: placementResponse.crid
creativeId: placementResponse.crid,
meta: {
advertiserDomains: placementResponse.adomain || []
}
};

bids.push(bid);
Expand Down
54 changes: 44 additions & 10 deletions modules/adotBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function isBanner(mediaTypes) {
}

function isVideo(mediaTypes) {
return isPlainObject(mediaTypes) && isPlainObject(mediaTypes.video);
return isPlainObject(mediaTypes) && 'video' in mediaTypes;
}

function validateBanner(banner) {
Expand Down Expand Up @@ -104,13 +104,16 @@ function validateMediaSizes(mediaSize) {
function validateParameters(parameters, adUnit) {
if (isVideo(adUnit.mediaTypes)) {
if (!isPlainObject(parameters)) return false;
if (!isPlainObject(adUnit.mediaTypes.video)) return false;
if (!validateVideoParameters(parameters.video, adUnit)) return false;
}

return true;
}

function validateVideoParameters(video, adUnit) {
function validateVideoParameters(videoParams, adUnit) {
const video = adUnit.mediaTypes.video;

if (!video) return false;

if (!isArray(video.mimes)) return false;
Expand All @@ -124,9 +127,9 @@ function validateVideoParameters(video, adUnit) {
if (video.protocols.length === 0) return false;
if (!video.protocols.every(isNumber)) return false;

if (isInstream(adUnit.mediaTypes.video)) {
if (!video.instreamContext) return false;
if (SUPPORTED_INSTREAM_CONTEXTS.indexOf(video.instreamContext) === -1) return false;
if (isInstream(video)) {
if (!videoParams.instreamContext) return false;
if (SUPPORTED_INSTREAM_CONTEXTS.indexOf(videoParams.instreamContext) === -1) return false;
}

return true;
Expand Down Expand Up @@ -203,7 +206,7 @@ function generateImpressionsFromAdUnit(acc, adUnit) {

if (mediaType === 'banner') return acc.concat(generateBannerFromAdUnit(impId, data, params));
if (mediaType === 'video') return acc.concat({id: impId, video: generateVideoFromAdUnit(data, params), pmp, ext});
if (mediaType === 'native') return acc.concat({id: impId, native: generateNativeFromAdUnit(data, params), pmp, ext});
if (mediaType === 'native') return acc.concat({id: impId, native: generateNativeFromAdUnit(data), pmp, ext});
}, []);

return acc.concat(imps);
Expand All @@ -226,25 +229,52 @@ function generateBannerFromAdUnit(impId, data, params) {

function generateVideoFromAdUnit(data, params) {
const {playerSize} = data;
const video = data

const hasPlayerSize = isArray(playerSize) && playerSize.length > 0;
const {position, video = {}} = params;
const {minDuration, maxDuration, protocols} = video;

const size = {width: hasPlayerSize ? playerSize[0][0] : null, height: hasPlayerSize ? playerSize[0][1] : null};
const duration = {min: isNumber(minDuration) ? minDuration : null, max: isNumber(maxDuration) ? maxDuration : null};
const startdelay = computeStartDelay(data, params);

return {
mimes: SUPPORTED_VIDEO_MIMES,
skip: video.skippable || 0,
w: size.width,
h: size.height,
startdelay: computeStartDelay(data, params),
startdelay: startdelay,
linearity: video.linearity || null,
minduration: duration.min,
maxduration: duration.max,
protocols,
pos: position || 0
api: getApi(protocols),
format: hasPlayerSize ? playerSize.map(s => {
return {w: s[0], h: s[1]};
}) : null,
pos: video.position || 0
};
}

function getApi(protocols) {
let defaultValue = [2];
let listProtocols = [
{key: 'VPAID_1_0', value: 1},
{key: 'VPAID_2_0', value: 2},
{key: 'MRAID_1', value: 3},
{key: 'ORMMA', value: 4},
{key: 'MRAID_2', value: 5},
{key: 'MRAID_3', value: 6},
];
if (protocols) {
return listProtocols.filter(p => {
return protocols.indexOf(p.key) !== -1;
}).map(p => p.value)
} else {
return defaultValue;
}
}

function isInstream(video) {
return isPlainObject(video) && (video.context === 'instream');
}
Expand All @@ -263,7 +293,7 @@ function computeStartDelay(data, params) {
return null;
}

function generateNativeFromAdUnit(data, params) {
function generateNativeFromAdUnit(data) {
const {type} = data;
const presetFormatter = type && NATIVE_PRESET_FORMATTERS[data.type];
const nativeFields = presetFormatter ? presetFormatter(data) : data;
Expand Down Expand Up @@ -500,6 +530,10 @@ function generateAdFromBid(bid, bidResponse, serverRequest) {
mediaType: bid.ext.adot.media_type,
};

if (bid.adomain) {
base.meta = { advertiserDomains: bid.adomain };
}

if (isBidANative(bid)) return {...base, native: formatNativeData(bid)};

const size = getSizeFromBid(bid, impressionData);
Expand Down
44 changes: 21 additions & 23 deletions modules/adotBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,22 @@ const adUnit = {
context: 'outstream',
// Video dimensions supported by the video ad unit.
// Each ad unit size is formatted as follows: [width, height].
playerSize: [[300, 250]]
playerSize: [[300, 250]],
// Content MIME types supported by the ad unit.
mimes: ['video/mp4'],
// Minimum accepted video ad duration (in seconds).
minDuration: 5,
// Maximum accepted video ad duration (in seconds).
maxDuration: 35,
// Video protocols supported by the ad unit (see the OpenRTB 2.5 specifications,
// section 5.8).
protocols: [2, 3]
}
},
bids: [{
bidder: 'adot',
params: {
video: {
// Content MIME types supported by the ad unit.
mimes: ['video/mp4'],
// Minimum accepted video ad duration (in seconds).
minDuration: 5,
// Maximum accepted video ad duration (in seconds).
maxDuration: 35,
// Video protocols supported by the ad unit (see the OpenRTB 2.5 specifications,
// section 5.8).
protocols: [2, 3]
}
video: {}
}
}]
}
Expand All @@ -82,23 +81,22 @@ const adUnit = {
context: 'instream',
// Video dimensions supported by the video ad unit.
// Each ad unit size is formatted as follows: [width, height].
playerSize: [[300, 250]]
playerSize: [[300, 250]],
// Content MIME types supported by the ad unit.
mimes: ['video/mp4'],
// Minimum accepted video ad duration (in seconds).
minDuration: 5,
// Maximum accepted video ad duration (in seconds).
maxDuration: 35,
// Video protocols supported by the ad unit (see the OpenRTB 2.5 specifications,
// section 5.8).
protocols: [2, 3]
}
},
bids: [{
bidder: 'adot',
params: {
video: {
// Content MIME types supported by the ad unit.
mimes: ['video/mp4'],
// Minimum accepted video ad duration (in seconds).
minDuration: 5,
// Maximum accepted video ad duration (in seconds).
maxDuration: 35,
// Video protocols supported by the ad unit (see the OpenRTB 2.5 specifications,
// section 5.8).
protocols: [2, 3],
// Instream video context. Must be either 'pre-roll', 'mid-roll' or 'post-roll'.
instreamContext: 'pre-roll'
}
}
Expand Down
5 changes: 4 additions & 1 deletion modules/adtargetBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ function createBid(bidResponse, bidRequest) {
cpm: bidResponse.cpm,
netRevenue: true,
mediaType,
ttl: 300
ttl: 300,
meta: {
advertiserDomains: bidResponse.adomain || []
}
};

if (mediaType === BANNER) {
Expand Down
Loading

0 comments on commit 353a3d8

Please sign in to comment.