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
  • Loading branch information
rmartinez authored and rmartinez committed Dec 2, 2019
2 parents 227beca + 41d1d5d commit 6687a62
Show file tree
Hide file tree
Showing 22 changed files with 1,018 additions and 84 deletions.
40 changes: 30 additions & 10 deletions modules/adheseBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const spec = {
supportedMediaTypes: [BANNER, VIDEO],

isBidRequestValid: function(bid) {
return !!(bid.params.account && bid.params.location && bid.params.format);
return !!(bid.params.account && bid.params.location && (bid.params.format || bid.mediaTypes.banner.sizes));
},

buildRequests: function(validBidRequests, bidderRequest) {
Expand Down Expand Up @@ -83,7 +83,10 @@ function adResponse(bid, ad) {
width: Number(ad.width),
height: Number(ad.height),
creativeId: adDetails.creativeId,
dealId: adDetails.dealId
dealId: adDetails.dealId,
adhese: {
originData: adDetails.originData
}
});

if (bidResponse.mediaType === VIDEO) {
Expand Down Expand Up @@ -112,7 +115,19 @@ function mergeTargets(targets, target) {
}

function bidToSlotName(bid) {
return bid.params.location + '-' + bid.params.format;
if (bid.params.format) {
return bid.params.location + '-' + bid.params.format;
}

var sizes = bid.mediaTypes.banner.sizes;
sizes.sort();
var format = sizes.map(size => size[0] + 'x' + size[1]).join('_');

if (format.length > 0) {
return bid.params.location + '-' + format;
} else {
return bid.params.location;
}
}

function getAccount(validBidRequests) {
Expand Down Expand Up @@ -150,22 +165,27 @@ function getPrice(ad) {
function getAdDetails(ad) {
let creativeId = '';
let dealId = '';
let originData = {};

if (isAdheseAd(ad)) {
creativeId = ad.id;
dealId = ad.orderId;
originData = { priority: ad.priority, orderProperty: ad.orderProperty, adFormat: ad.adFormat, adType: ad.adType, libId: ad.libId, adspaceId: ad.adspaceId, viewableImpressionCounter: ad.viewableImpressionCounter };
} else {
creativeId = ad.origin + (ad.originInstance ? '-' + ad.originInstance : '');
if (ad.originData && ad.originData.seatbid && ad.originData.seatbid.length) {
const seatbid = ad.originData.seatbid[0];
if (seatbid.bid && seatbid.bid.length) {
const bid = seatbid.bid[0];
creativeId = String(bid.crid || '');
dealId = String(bid.dealid || '');
if (ad.originData) {
originData = ad.originData;
if (ad.originData.seatbid && ad.originData.seatbid.length) {
const seatbid = ad.originData.seatbid[0];
if (seatbid.bid && seatbid.bid.length) {
const bid = seatbid.bid[0];
creativeId = String(bid.crid || '');
dealId = String(bid.dealid || '');
}
}
}
}
return { creativeId: creativeId, dealId: dealId };
return { creativeId: creativeId, dealId: dealId, originData: originData };
}

function base64urlEncode(s) {
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', 'audiencemedia', 'waardex_ak'],
aliases: ['headbidding', 'adsolut', 'oftmediahb', 'audiencemedia', 'waardex_ak', 'roqoon'],
supportedMediaTypes: [BANNER, VIDEO],
isBidRequestValid: function(bidRequest) {
return 'params' in bidRequest &&
Expand Down
21 changes: 12 additions & 9 deletions modules/colossussspBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes';
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';
const G_URL = 'https://colossusssp.com/?c=o&m=multi';
const G_URL_SYNC = 'https://colossusssp.com/?c=o&m=cookie';

function isBidResponseValid(bid) {
if (!bid.requestId || !bid.cpm || !bid.creativeId || !bid.ttl || !bid.currency) {
Expand Down Expand Up @@ -42,15 +42,16 @@ export const spec = {
* @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) => {
buildRequests: (validBidRequests, bidderRequest) => {
let winTop = window;
let location;
try {
window.top.location.toString();
location = new URL(bidderRequest.refererInfo.referer)
winTop = window.top;
} catch (e) {
location = winTop.location;
utils.logMessage(e);
};
let location = utils.getTopWindowLocation();
let placements = [];
let request = {
'deviceWidth': winTop.screen.width,
Expand All @@ -61,19 +62,21 @@ export const spec = {
'page': location.pathname,
'placements': placements
};

for (let i = 0; i < validBidRequests.length; i++) {
let bid = validBidRequests[i];
let traff = bid.params.traffic || BANNER
let placement = {
placementId: bid.params.placement_id,
bidId: bid.bidId,
sizes: bid.sizes,
traffic: bid.params.traffic || BANNER
sizes: bid.mediaTypes[traff].sizes,
traffic: traff
};
placements.push(placement);
}
return {
method: 'POST',
url: URL,
url: G_URL,
data: request
};
},
Expand Down Expand Up @@ -103,7 +106,7 @@ export const spec = {
getUserSyncs: () => {
return [{
type: 'image',
url: URL_SYNC
url: G_URL_SYNC
}];
}
};
Expand Down
6 changes: 5 additions & 1 deletion modules/colossussspBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ Module that connects to Colossus SSP demand sources
```
var adUnits = [{
code: 'placementid_0',
sizes: [[300, 250]],
mediaTypes: {
banner: {
sizes: [[300, 250], [300,600]]
}
},
bids: [{
bidder: 'colossusssp',
params: {
Expand Down
7 changes: 6 additions & 1 deletion modules/conversantBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,12 @@ export const spec = {
};

if (request.video) {
bid.vastUrl = responseAd;
if (responseAd.charAt(0) === '<') {
bid.vastXml = responseAd;
} else {
bid.vastUrl = responseAd;
}

bid.mediaType = 'video';
bid.width = request.video.w;
bid.height = request.video.h;
Expand Down
Loading

0 comments on commit 6687a62

Please sign in to comment.