Skip to content

Commit

Permalink
Merge branch 'master' into schain_pr
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkorean authored Jul 23, 2020
2 parents 4a03dc8 + 0336acd commit 0366161
Show file tree
Hide file tree
Showing 29 changed files with 1,972 additions and 255 deletions.
30 changes: 20 additions & 10 deletions modules/adkernelAdnBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ function canonicalizeSizesArray(sizes) {
return sizes;
}

function buildRequestParams(tags, auctionId, transactionId, gdprConsent, uspConsent, refInfo) {
function buildRequestParams(tags, bidderRequest) {
let {auctionId, gdprConsent, uspConsent, transactionId, refererInfo} = bidderRequest;
let req = {
id: auctionId,
tid: transactionId,
site: buildSite(refInfo),
site: buildSite(refererInfo),
imp: tags
};
if (gdprConsent) {
Expand Down Expand Up @@ -132,14 +133,13 @@ export const spec = {
return acc;
}, {});

let {auctionId, gdprConsent, uspConsent, transactionId, refererInfo} = bidderRequest;
let requests = [];
Object.keys(dispatch).forEach(host => {
Object.keys(dispatch[host]).forEach(pubId => {
let request = buildRequestParams(dispatch[host][pubId], auctionId, transactionId, gdprConsent, uspConsent, refererInfo);
let request = buildRequestParams(dispatch[host][pubId], bidderRequest);
requests.push({
method: 'POST',
url: `https://${host}/tag?account=${pubId}&pb=1${isRtbDebugEnabled(refererInfo) ? '&debug=1' : ''}`,
url: `https://${host}/tag?account=${pubId}&pb=1${isRtbDebugEnabled(bidderRequest.refererInfo) ? '&debug=1' : ''}`,
data: JSON.stringify(request)
})
});
Expand All @@ -159,14 +159,24 @@ export const spec = {
},

getUserSyncs: function(syncOptions, serverResponses) {
if (!syncOptions.iframeEnabled || !serverResponses || serverResponses.length === 0) {
if (!serverResponses || serverResponses.length === 0) {
return [];
}
if (syncOptions.iframeEnabled) {
return buildSyncs(serverResponses, 'syncpages', 'iframe');
} else if (syncOptions.pixelEnabled) {
return buildSyncs(serverResponses, 'syncpixels', 'image');
} else {
return [];
}
return serverResponses.filter(rps => rps.body && rps.body.syncpages)
.map(rsp => rsp.body.syncpages)
.reduce((a, b) => a.concat(b), [])
.map(syncUrl => ({type: 'iframe', url: syncUrl}));
}
};

function buildSyncs(serverResponses, propName, type) {
return serverResponses.filter(rps => rps.body && rps.body[propName])
.map(rsp => rsp.body[propName])
.reduce((a, b) => a.concat(b), [])
.map(syncUrl => ({type: type, url: syncUrl}));
}

registerBidder(spec);
110 changes: 110 additions & 0 deletions modules/boldwinBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import {registerBidder} from '../src/adapters/bidderFactory.js';
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
import * as utils from '../src/utils.js';

const BIDDER_CODE = 'boldwin';
const AD_URL = 'https://ssp.videowalldirect.com/?c=o&m=multi';
const SYNC_URL = 'https://cs.videowalldirect.com/?c=o&m=cookie'

function isBidResponseValid(bid) {
if (!bid.requestId || !bid.cpm || !bid.creativeId ||
!bid.ttl || !bid.currency) {
return false;
}
switch (bid.mediaType) {
case BANNER:
return Boolean(bid.width && bid.height && bid.ad);
case VIDEO:
return Boolean(bid.vastUrl);
case NATIVE:
return Boolean(bid.native && bid.native.title && bid.native.image && bid.native.impressionTrackers);
default:
return false;
}
}

export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: [BANNER, VIDEO, NATIVE],

isBidRequestValid: (bid) => {
return Boolean(bid.bidId && bid.params && !isNaN(parseInt(bid.params.placementId)));
},

buildRequests: (validBidRequests = [], bidderRequest) => {
let winTop = window;
let location;
try {
location = new URL(bidderRequest.refererInfo.referer)
winTop = window.top;
} catch (e) {
location = winTop.location;
utils.logMessage(e);
};
let placements = [];
let request = {
'deviceWidth': winTop.screen.width,
'deviceHeight': winTop.screen.height,
'language': (navigator && navigator.language) ? navigator.language.split('-')[0] : '',
'secure': 1,
'host': location.host,
'page': location.pathname,
'placements': placements
};
if (bidderRequest) {
if (bidderRequest.uspConsent) {
request.ccpa = bidderRequest.uspConsent;
}
if (bidderRequest.gdprConsent) {
request.gdpr = bidderRequest.gdprConsent
}
}
const len = validBidRequests.length;

for (let i = 0; i < len; i++) {
let bid = validBidRequests[i];
let sizes
if (bid.mediaTypes) {
if (bid.mediaTypes[BANNER] && bid.mediaTypes[BANNER].sizes) {
sizes = bid.mediaTypes[BANNER].sizes
} else if (bid.mediaTypes[VIDEO] && bid.mediaTypes[VIDEO].playerSize) {
sizes = bid.mediaTypes[VIDEO].playerSize
}
}
placements.push({
placementId: bid.params.placementId,
bidId: bid.bidId,
sizes: sizes || [],
wPlayer: sizes ? sizes[0] : 0,
hPlayer: sizes ? sizes[1] : 0,
traffic: bid.params.traffic || BANNER,
schain: bid.schain || {}
});
}
return {
method: 'POST',
url: AD_URL,
data: request
};
},

interpretResponse: (serverResponse) => {
let response = [];
for (let i = 0; i < serverResponse.body.length; i++) {
let resItem = serverResponse.body[i];
if (isBidResponseValid(resItem)) {
response.push(resItem);
}
}
return response;
},

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

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

```
Module Name: boldwin Bidder Adapter
Module Type: boldwin Bidder Adapter
```

# Description

Module that connects to boldwin demand sources

# Test Parameters
```
var adUnits = [
// Will return static test banner
{
code: 'placementId_0',
mediaTypes: {
banner: {
sizes: [[300, 250]],
}
},
bids: [
{
bidder: 'boldwin',
params: {
placementId: 0,
traffic: 'banner'
}
}
]
},
// Will return test vast xml. All video params are stored under placement in publishers UI
{
code: 'placementId_0',
mediaTypes: {
video: {
playerSize: [640, 480],
context: 'instream'
}
},
bids: [
{
bidder: 'boldwin',
params: {
placementId: 0,
traffic: 'video'
}
}
]
}
];
```
5 changes: 0 additions & 5 deletions modules/consentManagementUsp.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,6 @@ export function requestBidsHook(fn, reqBidsConfigObj) {
timer: null
};

// in case we already have consent (eg during bid refresh)
if (consentData) {
return exitModule(null, hookConfig);
}

if (!uspCallMap[consentAPI]) {
utils.logWarn(`USP framework (${consentAPI}) is not a supported framework. Aborting consentManagement module and resuming auction.`);
return hookConfig.nextFn.apply(hookConfig.context, hookConfig.args);
Expand Down
2 changes: 1 addition & 1 deletion modules/ixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import isInteger from 'core-js-pure/features/number/is-integer.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';

const BIDDER_CODE = 'ix';
const SECURE_BID_URL = 'https://as-sec.casalemedia.com/cygnus';
const SECURE_BID_URL = 'https://htlb.casalemedia.com/cygnus';
const SUPPORTED_AD_TYPES = [BANNER, VIDEO];
const BANNER_ENDPOINT_VERSION = 7.2;
const VIDEO_ENDPOINT_VERSION = 8.1;
Expand Down
Loading

0 comments on commit 0366161

Please sign in to comment.