Skip to content

Commit

Permalink
Merge branch 'master' into Widespace_adapter
Browse files Browse the repository at this point in the history
* master:
  Update Vertoz adapter for Prebid 1.0 (prebid#2104)
  Add multiple bids request  (prebid#2136)
  [NEW Adapter] RTBHouseBidAdapter (prebid#2184)
  Update Innity Adapter to Prebid.js v1.0 (prebid#2180)
  Update Adyoulike Adapter to prebid 1.0 (prebid#2077)
  Change bidderCode for DAN Marketplace Bid Adapter (prebid#2183)
  only count bid timeouts if bidder didn't call done. fixes prebid#2146 (prebid#2154)
  [Edit BidAdapter] rxrtb adapter for Perbid.js 1.0 (prebid#2182)
  Update NasmediaAdmixer adapter (prebid#2164)
  only do video caching if we don't already have a videoCacheKey (prebid#2143)
  • Loading branch information
mizmaar3 committed Feb 28, 2018
2 parents 75b824f + 9d55719 commit 2a7d099
Show file tree
Hide file tree
Showing 21 changed files with 1,329 additions and 83 deletions.
197 changes: 197 additions & 0 deletions modules/adyoulikeBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
import * as utils from 'src/utils';
import { format } from 'src/url';
// import { config } from 'src/config';
import { registerBidder } from 'src/adapters/bidderFactory';

const VERSION = '1.0';
const BIDDER_CODE = 'adyoulike';
const DEFAULT_DC = 'hb-api';

export const spec = {
code: BIDDER_CODE,
aliases: ['ayl'], // short code
/**
* 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) {
const sizes = getSize(bid.sizes);
if (!bid.params || !bid.params.placement || !sizes.width || !sizes.height) {
return false;
}
return true;
},
/**
* 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) {
let dcHostname = getHostname(bidderRequest);
const payload = {
Version: VERSION,
Bids: bidderRequest.reduce((accumulator, bid) => {
let size = getSize(bid.sizes);
accumulator[bid.bidId] = {};
accumulator[bid.bidId].PlacementID = bid.params.placement;
accumulator[bid.bidId].TransactionID = bid.transactionId;
accumulator[bid.bidId].Width = size.width;
accumulator[bid.bidId].Height = size.height;
return accumulator;
}, {}),
PageRefreshed: getPageRefreshed()
};
const data = JSON.stringify(payload);
const options = {
withCredentials: false
};

return {
method: 'POST',
url: createEndpoint(dcHostname),
data,
options
};
},
/**
* 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 = [];
// For this adapter, serverResponse is a list
serverResponse.body.forEach(response => {
const bid = createBid(response);
if (bid) {
bidResponses.push(bid);
}
});
return bidResponses;
}
}

/* Get hostname from bids */
function getHostname(bidderRequest) {
let dcHostname = bidderRequest.find(bid => bid.params.DC);
if (dcHostname) {
return ('-' + dcHostname.params.DC);
}
return '';
}

/* Get current page referrer url */
function getReferrerUrl() {
let referer = '';
if (window.self !== window.top) {
try {
referer = window.top.document.referrer;
} catch (e) { }
} else {
referer = document.referrer;
}
return referer;
}

/* Get current page canonical url */
function getCanonicalUrl() {
let link;
if (window.self !== window.top) {
try {
link = window.top.document.head.querySelector('link[rel="canonical"][href]');
} catch (e) { }
} else {
link = document.head.querySelector('link[rel="canonical"][href]');
}

if (link) {
return link.href;
}
return '';
}

/* Get information on page refresh */
function getPageRefreshed() {
try {
if (performance && performance.navigation) {
return performance.navigation.type === performance.navigation.TYPE_RELOAD;
}
} catch (e) { }
return false;
}

/* Create endpoint url */
function createEndpoint(host) {
return format({
protocol: (document.location.protocol === 'https:') ? 'https' : 'http',
host: `${DEFAULT_DC}${host}.omnitagjs.com`,
pathname: '/hb-api/prebid/v1',
search: createEndpointQS()
});
}

/* Create endpoint query string */
function createEndpointQS() {
const qs = {};

const ref = getReferrerUrl();
if (ref) {
qs.RefererUrl = encodeURIComponent(ref);
}

const can = getCanonicalUrl();
if (can) {
qs.CanonicalUrl = encodeURIComponent(can);
}

return qs;
}

/* Get parsed size from request size */
function getSize(requestSizes) {
const parsed = {};
const size = utils.parseSizesInput(requestSizes)[0];

if (typeof size !== 'string') {
return parsed;
}

const parsedSize = size.toUpperCase().split('X');
const width = parseInt(parsedSize[0], 10);
if (width) {
parsed.width = width;
}

const height = parseInt(parsedSize[1], 10);
if (height) {
parsed.height = height;
}

return parsed;
}

/* Create bid from response */
function createBid(response) {
if (!response || !response.Ad) {
return
}

return {
requestId: response.BidID,
bidderCode: spec.code,
width: response.Width,
height: response.Height,
ad: response.Ad,
ttl: 3600,
creativeId: response.CreativeID,
cpm: response.Price,
netRevenue: true,
currency: 'USD'
};
}

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

Module Name: Adyoulike Bidder Adapter
Module Type: Bidder Adapter
Maintainer: prebid@adyoulike.com

# Description

Module that connects to Adyoulike demand sources.
Banner formats are supported.

# Test Parameters
```
var adUnits = [
{
code: 'test-div',
sizes: [[300, 250]],
bids: [
{
bidder: "adyoulike",
params: {
placement: 194f787b85c829fb8822cdaf1ae64435,
DC: 'fra01', // Optional for set the data center name
}
}
]
}
];
```
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';
const BIDDER_CODE = 'danmarketplace';
const BIDDER_CODE = 'danmarket';
const ENDPOINT_URL = '//ads.danmarketplace.com/hb';
const TIME_TO_LIVE = 360;
const ADAPTER_SYNC_URL = '//ads.danmarketplace.com/push_sync';
Expand All @@ -24,7 +24,7 @@ const LOG_ERROR_MESS = {
export const spec = {
code: BIDDER_CODE,

aliases: ['DANMarketplace', 'DAN_Marketplace'],
aliases: ['DANMarketplace', 'DAN_Marketplace', 'danmarketplace'],

isBidRequestValid: function(bid) {
return !!bid.params.uid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Module that connects to DAN Marketplace demand source to fetch bids.
sizes: [[300, 250]],
bids: [
{
bidder: "danmarketplace",
bidder: "danmarket",
params: {
uid: '4',
priceType: 'gross' // by default is 'net'
Expand All @@ -28,7 +28,7 @@ Module that connects to DAN Marketplace demand source to fetch bids.
sizes: [[728, 90]],
bids: [
{
bidder: "danmarketplace",
bidder: "danmarket",
params: {
uid: 5,
priceType: 'gross'
Expand Down
54 changes: 54 additions & 0 deletions modules/innityBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import * as utils from 'src/utils';
import { registerBidder } from 'src/adapters/bidderFactory';

const BIDDER_CODE = 'innity';
const ENDPOINT = location.protocol + '//as.innity.com/synd/';

export const spec = {
code: BIDDER_CODE,
isBidRequestValid: function(bid) {
return !!(bid.params && bid.params.pub && bid.params.zone);
},
buildRequests: function(validBidRequests) {
return validBidRequests.map(bidRequest => {
let parseSized = utils.parseSizesInput(bidRequest.sizes);
let arrSize = parseSized[0].split('x');
return {
method: 'GET',
url: ENDPOINT,
data: {
cb: utils.timestamp(),
ver: 2,
hb: 1,
output: 'js',
pub: bidRequest.params.pub,
zone: bidRequest.params.zone,
url: encodeURIComponent(utils.getTopWindowUrl()),
width: arrSize[0],
height: arrSize[1],
vpw: window.screen.width,
vph: window.screen.height,
callback: 'json',
callback_uid: bidRequest.bidId,
auction: bidRequest.auctionId,
},
};
});
},
interpretResponse: function(serverResponse, request) {
const res = serverResponse.body;
const bidResponse = {
requestId: res.callback_uid,
cpm: parseFloat(res.cpm) / 100,
width: res.width,
height: res.height,
creativeId: res.creative_id,
currency: 'USD',
netRevenue: true,
ttl: 60,
ad: '<script src="' + location.protocol + '//cdn.innity.net/frame_util.js"></script>' + res.tag,
};
return [bidResponse];
}
}
registerBidder(spec);
25 changes: 25 additions & 0 deletions modules/innityBidAdapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Overview

**Module Name**: Innity Bidder Adapter
**Module Type**: Bidder Adapter
**Maintainer**: engtat@innity.com

# Description

Innity Bidder Adapter for Prebid.js.

# Test Parameters
```
var adUnits = [{
code: 'div-gpt-ad-1460505748561-0',
sizes: [[300, 250]],
bids: [{
bidder: 'innity',
params: {
pub: 267,
zone: 62546
}
}]
}];
```
10 changes: 5 additions & 5 deletions modules/nasmediaAdmixerBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ export const spec = {

function getOsType() {
let ua = navigator.userAgent.toLowerCase();
let os = ['android', 'ios', 'mac', 'linux', 'window', 'etc'];
let regexp_os = [/android/i, /iphone|ipad/i, /mac/i, /linux/i, /window/i, ''];
let os = ['android', 'ios', 'mac', 'linux', 'window'];
let regexp_os = [/android/i, /iphone|ipad/i, /mac/i, /linux/i, /window/i];

return regexp_os.some((tos, idx) => {
if (ua.match(tos)) {
return os.find((tos, idx) => {
if (ua.match(regexp_os[idx])) {
return os[idx];
}
});
}) || 'etc';
}

function getSize(sizes) {
Expand Down
2 changes: 1 addition & 1 deletion modules/nasmediaAdmixerBidAdapter.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Overview

```
Module Name: NasmeidaAdmixer Bidder Adapter
Module Name: NasmediaAdmixer Bidder Adapter
Module Type: Bidder Adapter
Maintainer: prebid@nasmedia.co.kr
```
Expand Down
Loading

0 comments on commit 2a7d099

Please sign in to comment.