Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/prebid/Prebid.js
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/prebid/Prebid.js:
  Prebid 1.2.0 Release
  Use polyfilled includes method (prebid#2061)
  RockYou Adapter: Added RockYou Adapter supporting Prebid 1.0 (prebid#1977)
  Optimera Adapter for 1.0. (prebid#1961)
  Use cross-browser integer check (prebid#2058)
  Fix skipped test (prebid#2059)
  Support multiple media formats within a single ad unit (prebid#1991)
  pre1api module that allows use of deprecated pre1.0 API in Prebid 1.0 (prebid#1976)
  Colossus SSP header bidding adapter 1.0.0 (prebid#2029)
  InSkin Bidder Adapter (prebid#2016)
  Update adapter to prebid v1.0 (prebid#1908)
  PubMatic 1.0 adapter (prebid#2011)
  • Loading branch information
m.sorochuk committed Jan 24, 2018
2 parents 81cd86e + 65c76ef commit c01c4f0
Show file tree
Hide file tree
Showing 44 changed files with 2,977 additions and 167 deletions.
2 changes: 1 addition & 1 deletion modules/adkernelAdnBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const spec = {

code: 'adkernelAdn',

supportedMediaTypes: [VIDEO],
supportedMediaTypes: [BANNER, VIDEO],

isBidRequestValid: function(bidRequest) {
return 'params' in bidRequest && (typeof bidRequest.params.host === 'undefined' || typeof bidRequest.params.host === 'string') &&
Expand Down
2 changes: 1 addition & 1 deletion modules/adkernelBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const spec = {

code: 'adkernel',
aliases: ['headbidding'],
supportedMediaTypes: [VIDEO],
supportedMediaTypes: [BANNER, VIDEO],
isBidRequestValid: function(bidRequest) {
return 'params' in bidRequest && typeof bidRequest.params.host !== 'undefined' &&
'zoneId' in bidRequest.params && !isNaN(Number(bidRequest.params.zoneId));
Expand Down
4 changes: 2 additions & 2 deletions modules/adxcgBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import * as utils from 'src/utils';
import * as url from 'src/url';
import {registerBidder} from 'src/adapters/bidderFactory';
import {NATIVE, VIDEO} from 'src/mediaTypes';
import {BANNER, NATIVE, VIDEO} from 'src/mediaTypes';

/**
* Adapter for requesting bids from adxcg.net
* updated to latest prebid repo on 2017.10.20
*/

const BIDDER_CODE = 'adxcg';
const SUPPORTED_AD_TYPES = [VIDEO, NATIVE];
const SUPPORTED_AD_TYPES = [BANNER, VIDEO, NATIVE];
const SOURCE = 'pbjs10';
export const spec = {
code: BIDDER_CODE,
Expand Down
47 changes: 29 additions & 18 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { Renderer } from 'src/Renderer';
import * as utils from 'src/utils';
import { registerBidder } from 'src/adapters/bidderFactory';
import { NATIVE, VIDEO } from 'src/mediaTypes';
import { BANNER, NATIVE, VIDEO } from 'src/mediaTypes';
import find from 'core-js/library/fn/array/find';
import includes from 'core-js/library/fn/array/includes';

const BIDDER_CODE = 'appnexus';
const URL = '//ib.adnxs.com/ut/v3/prebid';
const SUPPORTED_AD_TYPES = ['banner', 'video', 'native'];
const VIDEO_TARGETING = ['id', 'mimes', 'minduration', 'maxduration',
'startdelay', 'skippable', 'playback_method', 'frameworks'];
const USER_PARAMS = ['age', 'external_uid', 'segments', 'gender', 'dnt', 'language'];
Expand All @@ -31,7 +30,7 @@ const SOURCE = 'pbjs';
export const spec = {
code: BIDDER_CODE,
aliases: ['appnexusAst', 'brealtime', 'pagescience', 'defymedia', 'gourmetads', 'matomy', 'featureforward', 'oftmedia', 'districtm'],
supportedMediaTypes: [VIDEO, NATIVE],
supportedMediaTypes: [BANNER, VIDEO, NATIVE],

/**
* Determines whether or not the given bid request is valid.
Expand Down Expand Up @@ -103,7 +102,7 @@ export const spec = {
serverResponse.tags.forEach(serverBid => {
const rtbBid = getRtbBid(serverBid);
if (rtbBid) {
if (rtbBid.cpm !== 0 && includes(SUPPORTED_AD_TYPES, rtbBid.ad_type)) {
if (rtbBid.cpm !== 0 && includes(this.supportedMediaTypes, rtbBid.ad_type)) {
const bid = newBid(serverBid, rtbBid);
bid.mediaType = parseMediaType(rtbBid);
bids.push(bid);
Expand Down Expand Up @@ -197,7 +196,6 @@ function newBid(serverBid, rtbBid) {
width: rtbBid.rtb.video.player_width,
height: rtbBid.rtb.video.player_height,
vastUrl: rtbBid.rtb.video.asset_url,
descriptionUrl: rtbBid.rtb.video.asset_url,
ttl: 3600
});
// This supports Outstream Video
Expand All @@ -209,9 +207,9 @@ function newBid(serverBid, rtbBid) {
bid.adResponse.ad = bid.adResponse.ads[0];
bid.adResponse.ad.video = bid.adResponse.ad.rtb.video;
}
} else if (rtbBid.rtb['native']) {
const nativeAd = rtbBid.rtb['native'];
bid['native'] = {
} else if (rtbBid.rtb[NATIVE]) {
const nativeAd = rtbBid.rtb[NATIVE];
bid[NATIVE] = {
title: nativeAd.title,
body: nativeAd.desc,
cta: nativeAd.ctatext,
Expand Down Expand Up @@ -256,6 +254,7 @@ function bidToTag(bid) {
const tag = {};
tag.sizes = transformSizes(bid.sizes);
tag.primary_size = tag.sizes[0];
tag.ad_types = [];
tag.uuid = bid.bidId;
if (bid.params.placementId) {
tag.id = parseInt(bid.params.placementId, 10);
Expand Down Expand Up @@ -294,19 +293,24 @@ function bidToTag(bid) {
tag.keywords = getKeywords(bid.params.keywords);
}

if (bid.mediaType === 'native' || utils.deepAccess(bid, 'mediaTypes.native')) {
tag.ad_types = ['native'];
if (bid.mediaType === NATIVE || utils.deepAccess(bid, `mediaTypes.${NATIVE}`)) {
tag.ad_types.push(NATIVE);

if (bid.nativeParams) {
const nativeRequest = buildNativeRequest(bid.nativeParams);
tag['native'] = {layouts: [nativeRequest]};
tag[NATIVE] = {layouts: [nativeRequest]};
}
}

const videoMediaType = utils.deepAccess(bid, 'mediaTypes.video');
const videoMediaType = utils.deepAccess(bid, `mediaTypes.${VIDEO}`);
const context = utils.deepAccess(bid, 'mediaTypes.video.context');

if (bid.mediaType === 'video' || (videoMediaType && context !== 'outstream')) {
if (bid.mediaType === VIDEO || videoMediaType) {
tag.ad_types.push(VIDEO);
}

// instream gets vastUrl, outstream gets vastXml
if (bid.mediaType === VIDEO || (videoMediaType && context !== 'outstream')) {
tag.require_asset_url = true;
}

Expand All @@ -318,6 +322,13 @@ function bidToTag(bid) {
.forEach(param => tag.video[param] = bid.params.video[param]);
}

if (
(utils.isEmpty(bid.mediaType) && utils.isEmpty(bid.mediaTypes)) ||
(bid.mediaType === BANNER || (bid.mediaTypes && bid.mediaTypes[BANNER]))
) {
tag.ad_types.push(BANNER);
}

return tag;
}

Expand Down Expand Up @@ -414,12 +425,12 @@ function handleOutstreamRendererEvents(bid, id, eventName) {

function parseMediaType(rtbBid) {
const adType = rtbBid.ad_type;
if (adType === 'video') {
return 'video';
} else if (adType === 'native') {
return 'native';
if (adType === VIDEO) {
return VIDEO;
} else if (adType === NATIVE) {
return NATIVE;
} else {
return 'banner';
return BANNER;
}
}

Expand Down
2 changes: 1 addition & 1 deletion modules/audienceNetworkBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const code = 'audienceNetwork';
const currency = 'USD';
const method = 'GET';
const url = 'https://an.facebook.com/v2/placementbid.json';
const supportedMediaTypes = ['video'];
const supportedMediaTypes = ['banner', 'video'];
const netRevenue = true;
const hb_bidder = 'fan';

Expand Down
132 changes: 132 additions & 0 deletions modules/colossussspBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
import { registerBidder } from 'src/adapters/bidderFactory';
import * as utils from 'src/utils';

const BIDDER_CODE = 'colossusssp';
const URL = '//colossusssp.com/?c=o&m=multi';
const URL_SYNC = '//colossusssp.com/?c=o&m=cookie';

let sizeObj = {
'468x60': 1,
'728x90': 2,
'300x600': 10,
'300x250': 15,
'300x100': 19,
'320x50': 43,
'300x50': 44,
'300x300': 48,
'300x1050': 54,
'970x90': 55,
'970x250': 57,
'1000x90': 58,
'320x80': 59,
'640x480': 65,
'320x480': 67,
'320x320': 72,
'320x160': 73,
'480x300': 83,
'970x310': 94,
'970x210': 96,
'480x320': 101,
'768x1024': 102,
'1000x300': 113,
'320x100': 117,
'800x250': 118,
'200x600': 119
};

utils._each(sizeObj, (item, key) => sizeObj[item] = key);

export const spec = {
code: BIDDER_CODE,

/**
* Determines whether or not the given bid request is valid.
*
* @param {object} bid The bid to validate.
* @return boolean True if this is a valid bid, and false otherwise.
*/
isBidRequestValid: (bid) => {
return (!isNaN(bid.params.placement_id) &&
((bid.params.sizes !== undefined && bid.params.sizes.length > 0 && bid.params.sizes.some((sizeIndex) => sizeObj[sizeIndex] !== undefined)) ||
(bid.sizes !== undefined && bid.sizes.length > 0 && bid.sizes.map((size) => `${size[0]}x${size[1]}`).some((size) => sizeObj[size] !== undefined))));
},

/**
* Make a server request from the list of BidRequests.
*
* @param {BidRequest[]} validBidRequests A non-empty list of valid bid requests that should be sent to the Server.
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: (validBidRequests) => {
let winTop = window;
try {
window.top.location.toString();
winTop = window.top;
} catch (e) {
utils.logMessage(e);
};
let location = utils.getTopWindowLocation();
let placements = [];
let request = {
'deviceWidth': winTop.screen.width,
'deviceHeight': winTop.screen.height,
'language': (navigator && navigator.language) ? navigator.language : '',
'secure': location.protocol === 'https:' ? 1 : 0,
'host': location.host,
'page': location.pathname,
'placements': placements
};
for (let i = 0; i < validBidRequests.length; i++) {
let bid = validBidRequests[i];
let placement = {};
placement['placementId'] = bid.params.placement_id;
placement['bidId'] = bid.bidId;
placement['sizes'] = bid.sizes;
placements.push(placement);
}
return {
method: 'POST',
url: URL,
data: request
};
},

/**
* Unpack the response from the server into a list of bids.
*
* @param {*} serverResponse A successful response from the server.
* @return {Bid[]} An array of bids which were nested inside the server.
*/
interpretResponse: (serverResponse) => {
let response = [];
try {
serverResponse = serverResponse.body;
for (let i = 0; i < serverResponse.length; i++) {
let resItem = serverResponse[i];
if (resItem.width && !isNaN(resItem.width) &&
resItem.height && !isNaN(resItem.height) &&
resItem.requestId && typeof resItem.requestId === 'string' &&
resItem.cpm && !isNaN(resItem.cpm) &&
resItem.ad && typeof resItem.ad === 'string' &&
resItem.ttl && !isNaN(resItem.ttl) &&
resItem.creativeId && typeof resItem.creativeId === 'string' &&
resItem.netRevenue && typeof resItem.netRevenue === 'boolean' &&
resItem.currency && typeof resItem.currency === 'string') {
response.push(resItem);
}
}
} catch (e) {
utils.logMessage(e);
};
return response;
},

getUserSyncs: () => {
return [{
type: 'image',
url: URL_SYNC
}];
}
};

registerBidder(spec);
26 changes: 26 additions & 0 deletions modules/colossussspBidAdapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Overview

```
Module Name: Colossus SSP Bidder Adapter
Module Type: Bidder Adapter
Maintainer: support@colossusmediallc.com
```

# Description

Module that connects to Colossus SSP demand sources

# Test Parameters
```
var adUnits = [{
code: 'placementid_0',
sizes: [[300, 250]],
bids: [{
bidder: 'colossusssp',
params: {
placement_id: 0
}
}]
}
];
```
4 changes: 2 additions & 2 deletions modules/conversantBidAdapter.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 { VIDEO } from 'src/mediaTypes';
import { BANNER, VIDEO } from 'src/mediaTypes';

const BIDDER_CODE = 'conversant';
const URL = '//media.msg.dotomi.com/s2s/header/24';
Expand All @@ -10,7 +10,7 @@ const VERSION = '2.2.1';
export const spec = {
code: BIDDER_CODE,
aliases: ['cnvr'], // short code
supportedMediaTypes: [VIDEO],
supportedMediaTypes: [BANNER, VIDEO],

/**
* Determines whether or not the given bid request is valid.
Expand Down
2 changes: 1 addition & 1 deletion modules/freewheelSSPBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ var getOutstreamScript = function(bid) {

export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: ['video'],
supportedMediaTypes: ['banner', 'video'],
aliases: ['stickyadstv'], // former name for freewheel-ssp
/**
* Determines whether or not the given bid request is valid.
Expand Down
Loading

0 comments on commit c01c4f0

Please sign in to comment.