Skip to content
This repository has been archived by the owner on Feb 13, 2021. It is now read-only.

Commit

Permalink
Merge pull request prebid#155 from CRAFT/release/2.10.0
Browse files Browse the repository at this point in the history
Release/2.10.0
  • Loading branch information
vzhukovsky authored and GitHub Enterprise committed May 21, 2018
2 parents 104f013 + d1560b2 commit 6fad643
Show file tree
Hide file tree
Showing 48 changed files with 10,879 additions and 7,372 deletions.
19 changes: 15 additions & 4 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
{
"presets": ["es2015"],
"presets": [
["env", {
"targets": {
"browsers": [
"chrome >= 61",
"safari >=8",
"edge >= 14",
"ff >= 57",
"ie >= 10",
"ios >= 8"
]
}
}]
],
"plugins": [
"transform-object-assign",
"transform-es3-property-literals",
"transform-es3-member-expression-literals"
"transform-object-assign"
]
}
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
AOL Prebid 2.10.0
----------------
Updated to Prebid 1.10.0


AOL Prebid 2.9.0
----------------
Updated to Prebid 1.9.0
Expand Down
25 changes: 17 additions & 8 deletions modules/a4gBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const spec = {
return bid.params && !!bid.params.zoneId;
},

buildRequests: function(validBidRequests) {
buildRequests: function(validBidRequests, bidderRequest) {
let deliveryUrl = '';
const idParams = [];
const sizeParams = [];
Expand All @@ -41,16 +41,25 @@ export const spec = {
deliveryUrl = A4G_DEFAULT_BID_URL;
}

let data = {
[IFRAME_PARAM_NAME]: 0,
[LOCATION_PARAM_NAME]: utils.getTopWindowUrl(),
[SIZE_PARAM_NAME]: sizeParams.join(ARRAY_PARAM_SEPARATOR),
[ID_PARAM_NAME]: idParams.join(ARRAY_PARAM_SEPARATOR),
[ZONE_ID_PARAM_NAME]: zoneIds.join(ARRAY_PARAM_SEPARATOR)
};

if (bidderRequest && bidderRequest.gdprConsent) {
data.gdpr = {
applies: bidderRequest.gdprConsent.gdprApplies,
consent: bidderRequest.gdprConsent.consentString
};
}

return {
method: 'GET',
url: deliveryUrl,
data: {
[IFRAME_PARAM_NAME]: 0,
[LOCATION_PARAM_NAME]: utils.getTopWindowUrl(),
[SIZE_PARAM_NAME]: sizeParams.join(ARRAY_PARAM_SEPARATOR),
[ID_PARAM_NAME]: idParams.join(ARRAY_PARAM_SEPARATOR),
[ZONE_ID_PARAM_NAME]: zoneIds.join(ARRAY_PARAM_SEPARATOR)
}
data: data
};
},

Expand Down
5 changes: 4 additions & 1 deletion modules/aolPartnersIds.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,8 @@
"unruly": 154,
"dgads": 155,
"consumable": 156,
"admatic": 157
"admatic": 157,
"oneVideo": 158,
"onetag": 159,
"ix": 160
}
1 change: 1 addition & 0 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ function newBid(serverBid, rtbBid, bidderRequest) {
clickUrl: nativeAd.link.url,
clickTrackers: nativeAd.link.click_trackers,
impressionTrackers: nativeAd.impression_trackers,
javascriptTrackers: nativeAd.javascript_trackers,
};
if (nativeAd.main_img) {
bid['native'].image = {
Expand Down
32 changes: 25 additions & 7 deletions modules/beachfrontBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@ export const spec = {
return !!(bid && bid.params && bid.params.appId && bid.params.bidfloor);
},

buildRequests(bids) {
buildRequests(bids, bidderRequest) {
let requests = [];
let videoBids = bids.filter(bid => isVideoBid(bid));
let bannerBids = bids.filter(bid => !isVideoBid(bid));
videoBids.forEach(bid => {
requests.push({
method: 'POST',
url: VIDEO_ENDPOINT + bid.params.appId,
data: createVideoRequestData(bid),
data: createVideoRequestData(bid, bidderRequest),
bidRequest: bid
});
});
if (bannerBids.length) {
requests.push({
method: 'POST',
url: BANNER_ENDPOINT,
data: createBannerRequestData(bannerBids),
data: createBannerRequestData(bannerBids, bidderRequest),
bidRequest: bannerBids
});
}
Expand Down Expand Up @@ -184,11 +184,11 @@ function getVideoParams(bid) {
}, {});
}

function createVideoRequestData(bid) {
function createVideoRequestData(bid, bidderRequest) {
let size = getFirstSize(bid);
let video = getVideoParams(bid);
let topLocation = utils.getTopWindowLocation();
return {
let payload = {
isPrebid: true,
appId: bid.params.appId,
domain: document.location.hostname,
Expand All @@ -214,11 +214,21 @@ function createVideoRequestData(bid) {
js: 1,
geo: {}
},
regs: {},
user: {},
cur: ['USD']
};

if (bidderRequest && bidderRequest.gdprConsent) {
let { consentRequired, consentString } = bidderRequest.gdprConsent;
payload.regs.ext = { gdpr: consentRequired ? 1 : 0 };
payload.user.ext = { consent: consentString };
}

return payload;
}

function createBannerRequestData(bids) {
function createBannerRequestData(bids, bidderRequest) {
let topLocation = utils.getTopWindowLocation();
let referrer = utils.getTopWindowReferrer();
let slots = bids.map(bid => {
Expand All @@ -229,7 +239,7 @@ function createBannerRequestData(bids) {
sizes: getSizes(bid)
};
});
return {
let payload = {
slots: slots,
page: topLocation.href,
domain: topLocation.hostname,
Expand All @@ -243,6 +253,14 @@ function createBannerRequestData(bids) {
adapterVersion: ADAPTER_VERSION,
adapterName: ADAPTER_NAME
};

if (bidderRequest && bidderRequest.gdprConsent) {
let { consentRequired, consentString } = bidderRequest.gdprConsent;
payload.gdpr = consentRequired ? 1 : 0;
payload.gdprConsent = consentString;
}

return payload;
}

registerBidder(spec);
125 changes: 121 additions & 4 deletions modules/bridgewellBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import * as utils from 'src/utils';
import {registerBidder} from 'src/adapters/bidderFactory';
import {BANNER, NATIVE} from 'src/mediaTypes';
import find from 'core-js/library/fn/array/find';

const BIDDER_CODE = 'bridgewell';
const REQUEST_ENDPOINT = '//rec.scupio.com/recweb/prebid.aspx?cb=' + Math.random();
const BIDDER_VERSION = '0.0.1';

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

/**
* Determines whether or not the given bid request is valid.
Expand Down Expand Up @@ -59,6 +62,10 @@ export const spec = {
method: 'POST',
url: REQUEST_ENDPOINT,
data: {
version: {
prebid: '$prebid.version$',
bridgewell: BIDDER_VERSION
},
adUnits: adUnits
},
validBidRequests: validBidRequests
Expand Down Expand Up @@ -104,7 +111,7 @@ export const spec = {
});
}

if (sizeValid) { // dont care native sizes
if (sizeValid || (mediaTypes && mediaTypes.native)) { // dont care native sizes
valid = true;
}
}
Expand All @@ -120,23 +127,133 @@ export const spec = {
// check required parameters
if (typeof matchedResponse.cpm !== 'number') {
return;
} else if (typeof matchedResponse.ad !== 'string') {
return;
} else if (typeof matchedResponse.netRevenue !== 'boolean') {
return;
} else if (typeof matchedResponse.currency !== 'string') {
return;
} else if (typeof matchedResponse.mediaType !== 'string') {
return;
}

bidResponse.requestId = req.bidId;
bidResponse.cpm = matchedResponse.cpm * req.params.cpmWeight;
bidResponse.width = matchedResponse.width;
bidResponse.height = matchedResponse.height;
bidResponse.ad = matchedResponse.ad;
bidResponse.ttl = matchedResponse.ttl;
bidResponse.creativeId = matchedResponse.id;
bidResponse.netRevenue = matchedResponse.netRevenue;
bidResponse.currency = matchedResponse.currency;
bidResponse.mediaType = matchedResponse.mediaType;

// check required parameters by matchedResponse.mediaType
switch (matchedResponse.mediaType) {
case BANNER:
// check banner required parameters
if (typeof matchedResponse.ad !== 'string') {
return;
}

bidResponse.ad = matchedResponse.ad;
break;
case NATIVE:
// check native required parameters
if (!matchedResponse.native) {
return;
}

let req_nativeLayout = req.mediaTypes.native;
let res_native = matchedResponse.native;

// check title
let title = req_nativeLayout.title;
if (title && title.required) {
if (typeof res_native.title !== 'string') {
return;
} else if (title.len && title.len < res_native.title.length) {
return;
}
}

// check body
let body = req_nativeLayout.body;
if (body && body.required) {
if (typeof res_native.body !== 'string') {
return;
}
}

// check image
let image = req_nativeLayout.image;
if (image && image.required) {
if (res_native.image) {
if (typeof res_native.image.url !== 'string') { // check image url
return;
} else {
if (res_native.image.width !== image.sizes[0] || res_native.image.height !== image.sizes[1]) { // check image sizes
return;
}
}
} else {
return;
}
}

// check sponsoredBy
let sponsoredBy = req_nativeLayout.sponsoredBy;
if (sponsoredBy && sponsoredBy.required) {
if (typeof res_native.sponsoredBy !== 'string') {
return;
}
}

// check icon
let icon = req_nativeLayout.icon;
if (icon && icon.required) {
if (res_native.icon) {
if (typeof res_native.icon.url !== 'string') { // check icon url
return;
} else {
if (res_native.icon.width !== icon.sizes[0] || res_native.icon.height !== icon.sizes[0]) { // check image sizes
return;
}
}
} else {
return;
}
}

// check clickUrl
if (typeof res_native.clickUrl !== 'string') {
return;
}

// check clickTracker
let clickTrackers = res_native.clickTrackers;
if (clickTrackers) {
if (clickTrackers.length === 0) {
return;
}
} else {
return;
}

// check impressionTrackers
let impressionTrackers = res_native.impressionTrackers;
if (impressionTrackers) {
if (impressionTrackers.length === 0) {
return;
}
} else {
return;
}

bidResponse.native = matchedResponse.native;

break;

default: // response mediaType is not supported
return;
}

bidResponses.push(bidResponse);
}
Expand Down
37 changes: 37 additions & 0 deletions modules/bridgewellBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,42 @@ Module that connects to Bridgewell demand source to fetch bids.
ChannelID: 'CgUxMjMzOBIBNiIGcGVubnkzKggI2AUQWhoBOQ'
}
}]
}, {
code: 'test-div',
sizes: [1, 1],
mediaTypes: {
native: {
title: {
required: true,
len: 80
},
body: {
required: true
},
image: {
required: true,
sizes: [150, 50]
},
icon: {
required: false,
sizes: [50, 50]
},
clickUrl: {
required: true
},
cta: {
required: false
},
sponsoredBy: {
required: false
}
}
},
bids: [{
bidder: 'bridgewell',
params: {
ChannelID: 'CgUxMjMzOBIBNiIGcGVubnkzKggI2AUQWhoBOQ'
}
}]
}];
```
Loading

0 comments on commit 6fad643

Please sign in to comment.