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: (23 commits)
  Update Atomx adapter for Prebid v1.0 (prebid#2026)
  Add vi bid adapter (prebid#2020)
  Add eplanningBidAdapter (prebid#2003)
  OpenX Adapter: Update to support mediaTypes field, instead of the deprecated mediaType field (prebid#1974)
  Separate bids & won calls (prebid#2015)
  1.0 adapter support for mantis (prebid#1840)
  Media.net adapter added (prebid#2038)
  GumGum Adapter for Prebid.js 1.0 (prebid#1966)
  Serverbid Bid Adapter: updated docs and ad sizes (prebid#2023)
  Adding districtm as an alias (prebid#2018)
  Use sudo to workaround Travis regression (prebid#2041)
  Fix uncached video bids triggering callback early (prebid#2017)
  Re-implemented RhythmOne audit beacon in prebid 1.0 interface (prebid#1953)
  Add NasmediaAdmixer adapter for Perbid.js 1.0 (prebid#1937)
  Update Adform adapter to Prebid v1.0 (prebid#1947)
  Upgrade Admixer adapter for Prebid 1.0 (prebid#1755)
  multiformat size validation checks (prebid#1964)
  Gjirafa Bidder Adapter (prebid#1944)
  pin gulp-connect at non-broken version (prebid#2008)
  Added dynamic ttl property for One Display and One Mobile. (prebid#2004)
  ...
  • Loading branch information
m.sorochuk committed Jan 23, 2018
2 parents 95fe42d + ecc34b6 commit 81cd86e
Show file tree
Hide file tree
Showing 56 changed files with 4,185 additions and 130 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
sudo: required

dist: trusty

language: node_js
Expand Down
2 changes: 1 addition & 1 deletion integrationExamples/gpt/pbjs_example_gpt.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
},
{
bidder: 'adform',
// available params: [ 'mid', 'inv', 'pdom', 'mname', 'mkw', 'mkv', 'cat', 'bcat', 'bcatrt', 'adv', 'advt', 'cntr', 'cntrt', 'maxp', 'minp', 'sminp', 'w', 'h', 'pb', 'pos', 'cturl', 'iturl', 'cttype', 'hidedomain', 'cdims', 'test' ]
// available params: [ 'mid', 'inv', 'pdom', 'mname', 'mkw', 'mkv', 'cat', 'bcat', 'bcatrt', 'adv', 'advt', 'cntr', 'cntrt', 'maxp', 'minp', 'sminp', 'w', 'h', 'pb', 'pos', 'cturl', 'iturl', 'cttype', 'hidedomain', 'cdims', 'test', priceType ]
params: {
adxDomain: 'adx.adform.net', //optional
mid: 158989,
Expand Down
107 changes: 107 additions & 0 deletions modules/adformBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
'use strict';

import {registerBidder} from 'src/adapters/bidderFactory';

const BIDDER_CODE = 'adform';
export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: [],
isBidRequestValid: function (bid) {
return !!(bid.params.mid);
},
buildRequests: function (validBidRequests) {
var i, l, j, k, bid, _key, _value, reqParams;
var request = [];
var globalParams = [ [ 'adxDomain', 'adx.adform.net' ], [ 'fd', 1 ], [ 'url', null ], [ 'tid', null ] ];
var netRevenue = 'net';
var bids = JSON.parse(JSON.stringify(validBidRequests));
for (i = 0, l = bids.length; i < l; i++) {
bid = bids[i];
if (bid.params.priceType === 'gross') {
netRevenue = 'gross';
}
for (j = 0, k = globalParams.length; j < k; j++) {
_key = globalParams[j][0];
_value = bid[_key] || bid.params[_key];
if (_value) {
bid[_key] = bid.params[_key] = null;
globalParams[j][1] = _value;
}
}
reqParams = bid.params;
reqParams.transactionId = bid.transactionId;
request.push(formRequestUrl(reqParams));
}

request.unshift('//' + globalParams[0][1] + '/adx/?rp=4');

request.push('stid=' + validBidRequests[0].requestId);

for (i = 1, l = globalParams.length; i < l; i++) {
_key = globalParams[i][0];
_value = globalParams[i][1];
if (_value) {
request.push(_key + '=' + encodeURIComponent(_value));
}
}

return {
method: 'GET',
url: request.join('&'),
bids: validBidRequests,
netRevenue: netRevenue,
bidder: 'adform'
};

function formRequestUrl(reqData) {
var key;
var url = [];

for (key in reqData) {
if (reqData.hasOwnProperty(key) && reqData[key]) { url.push(key, '=', reqData[key], '&'); }
}

return encodeURIComponent(btoa(url.join('').slice(0, -1)));
}
},
interpretResponse: function (serverResponse, bidRequest) {
var bidObject, response, bid;
var bidRespones = [];
var bids = bidRequest.bids;
var responses = serverResponse.body;
for (var i = 0; i < responses.length; i++) {
response = responses[i];
bid = bids[i];
if (response.response === 'banner' && verifySize(response, bid.sizes)) {
bidObject = {
requestId: bid.bidId,
cpm: response.win_bid,
width: response.width,
height: response.height,
creativeId: bid.bidId,
dealId: response.deal_id,
currency: response.win_cur,
netRevenue: bidRequest.netRevenue !== 'gross',
ttl: 360,
ad: response.banner,
bidderCode: bidRequest.bidder,
transactionId: bid.transactionId
};
bidRespones.push(bidObject);
}
}

return bidRespones;

function verifySize(adItem, validSizes) {
for (var j = 0, k = validSizes.length; j < k; j++) {
if (adItem.width === validSizes[j][0] &&
adItem.height === validSizes[j][1]) {
return true;
}
}
return false;
}
}
};
registerBidder(spec);
30 changes: 30 additions & 0 deletions modules/adformBidAdapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Overview

Module Name: Adform Bidder Adapter
Module Type: Bidder Adapter
Maintainer: Scope.FL.Scripts@adform.com

# Description

Module that connects to Adform demand sources to fetch bids.
Banner formats are supported.

# Test Parameters
```
var adUnits = [
{
code: 'div-gpt-ad-1460505748561-0',
sizes: [[300, 250], [250, 300], [300, 600], [600, 300]], // a display size
bids: [
{
bidder: "adform",
params: {
adxDomain: 'adx.adform.net', //optional
mid: '292063',
priceType: 'gross' // default is 'net'
}
}
]
},
];
```
74 changes: 74 additions & 0 deletions modules/admixerBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import * as utils from 'src/utils';
import {registerBidder} from 'src/adapters/bidderFactory';

const BIDDER_CODE = 'admixer';
const ENDPOINT_URL = '//inv-nets.admixer.net/prebid.1.0.aspx';
export const spec = {
code: BIDDER_CODE,
aliases: [],
supportedMediaTypes: ['banner', 'video'],
/**
* Determines whether or not the given bid request is valid.
*
* @param {BidRequest} bid The bid params to validate.
* @return boolean True if this is a valid bid, and false otherwise.
*/
isBidRequestValid: function (bid) {
return !!bid.params.zone;
},
/**
* Make a server request from the list of BidRequests.
*
* @param {bidderRequest} - bidderRequest.bids[] is an array of AdUnits and bids
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: function (bidderRequest) {
const payload = {
imps: [],
referrer: utils.getTopWindowUrl(),
};
bidderRequest.forEach((bid) => {
if (bid.bidder === BIDDER_CODE) {
payload.imps.push(bid);
}
});
const payloadString = JSON.stringify(payload);
return {
method: 'GET',
url: ENDPOINT_URL,
data: `data=${payloadString}`,
};
},
/**
* 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: function (serverResponse, bidRequest) {
const bidResponses = [];
// loop through serverResponses {
try {
serverResponse = serverResponse.body;
serverResponse.forEach((bidResponse) => {
const bidResp = {
requestId: bidResponse.bidId,
cpm: bidResponse.cpm,
width: bidResponse.width,
height: bidResponse.height,
ad: bidResponse.ad,
ttl: bidResponse.ttl,
creativeId: bidResponse.creativeId,
netRevenue: bidResponse.netRevenue,
currency: bidResponse.currency,
vastUrl: bidResponse.vastUrl,
};
bidResponses.push(bidResp);
});
} catch (e) {
utils.logError(e);
}
return bidResponses;
}
};
registerBidder(spec);
52 changes: 52 additions & 0 deletions modules/admixerBidAdapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Overview

Module Name: Admixer Bidder Adapter
Module Type: Bidder Adapter
Maintainer: contact@admixer.net

# Description

Connects to Admixer demand source to fetch bids.
Banner and Video formats are supported.
Please use ```admixer``` as the bidder code.

# Test Parameters
```
var adUnits = [
{
code: 'desktop-banner-ad-div',
sizes: [[300, 250]], // a display size
bids: [
{
bidder: "admixer",
params: {
zone: '2eb6bd58-865c-47ce-af7f-a918108c3fd2'
}
}
]
},{
code: 'mobile-banner-ad-div',
sizes: [[300, 50]], // a mobile size
bids: [
{
bidder: "admixer",
params: {
zone: '62211486-c50b-4356-9f0f-411778d31fcc'
}
}
]
},{
code: 'video-ad',
sizes: [[300, 50]],
mediaType: 'video',
bids: [
{
bidder: "admixer",
params: {
zone: 'ebeb1e79-8cb4-4473-b2d0-2e24b7ff47fd'
}
}
]
},
];
```
Loading

0 comments on commit 81cd86e

Please sign in to comment.