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#75 in AOLP_ADS_JS/prebid.js from release/1.…
Browse files Browse the repository at this point in the history
…14.0 to master

* commit 'c008f3f531ae3409f4a16bf03470d84e82aead0e': (35 commits)
  Add adapters in aolPartnersIds.json.
  Add changelog entry.
  Prebid 0.19.0 Release
  check truthiness of adUnitCode (prebid#990)
  fixed exception when refreshing individual Ad Units and bidder responds slowly (prebid#989)
  Stub pixel drop to prevent network request in test (prebid#988)
  Updating Komoona adapter to support future Prebid requirements (prebid#974)
  Use stable version of Chrome (prebid#984)
  Revert to running browser tests in Travis (prebid#983)
  Fix issue with appnexusAst sending `user` object in the wrong place. (prebid#980)
  Integrate Browserstack tests into Travis CI build (prebid#839)
  Add StickyAdsTV Bidder adapter (prebid#916)
  Stronger xdomain checks (prebid#971)
  added matomy as an alias for appnexus (prebid#850)
  Added 152Media Appnexus Alias (prebid#952)
  OpenX Adapter: Handles fallback ads correctly as a no fill (prebid#39) (prebid#963)
  Use package dependencies for ES6 Array shims (prebid#962)
  Make x-domain safe frame example work out of the box (prebid#955)
  added usersync for adkernel adapter (prebid#951)
  Rubicon adapter: add a floor variable (prebid#964)
  ...
  • Loading branch information
vzhukovsky committed Mar 16, 2017
2 parents 3205055 + c008f3f commit 73af74d
Show file tree
Hide file tree
Showing 47 changed files with 3,222 additions and 643 deletions.
12 changes: 11 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
sudo: required
dist: trusty

language: node_js

node_js:
- "5.1"

addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable

before_install:
- npm install -g gulp
- export CHROME_BIN=chromium-browser
- export CHROME_BIN=google-chrome
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
AOL Prebid 1.14.0
----------------
Updated to Prebid 0.19.0


AOL Prebid 1.13.0
----------------
Updated to Prebid 0.18.0
Expand Down
23 changes: 22 additions & 1 deletion adapters.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"adform",
"adkernel",
"admedia",
"vertamedia",
"aol",
"appnexus",
"appnexusAst",
Expand All @@ -18,6 +19,8 @@
"indexExchange",
"kruxlink",
"komoona",
"lifestreet",
"mantis",
"openx",
"piximedia",
"pubmatic",
Expand All @@ -30,7 +33,9 @@
"sonobi",
"sovrn",
"springserve",
"stickyadstv",
"triplelift",
"twenga",
"yieldbot",
"nginad",
"brightcom",
Expand All @@ -45,6 +50,7 @@
"roxot",
"vertoz",
"widespace",
"admixer",
{
"appnexus": {
"alias": "brealtime"
Expand All @@ -64,16 +70,31 @@
"appnexusAst": {
"supportedMediaTypes": ["video"]
}
}, {
"vertamedia": {
"supportedMediaTypes": ["video"]
}
},
{
"appnexus": {
"alias": "matomy"
}
},
{
"rubicon": {
"alias": "rubiconLite"
"alias": "rubiconLite",
"supportedMediaTypes": ["video"]
}
},
{
"appnexus": {
"alias": "featureforward"
}
},
{
"appnexus": {
"alias": "oftmedia"
}
},
{
"adkernel": {
Expand Down
8 changes: 8 additions & 0 deletions browsers.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@
"device": null,
"os": "Windows"
},
"bs_chrome_56_mac_sierra": {
"base": "BrowserStack",
"os": "OS X",
"os_version": "Sierra",
"browser": "chrome",
"device": null,
"browser_version": "56.0"
},
"bs_safari_9.1_mac_elcapitan": {
"base": "BrowserStack",
"os_version": "El Capitan",
Expand Down
6 changes: 6 additions & 0 deletions integrationExamples/gpt/pbjs_example_gpt.html
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,12 @@
params: {
banner_id: 0
}
},
{
bidder: 'admixer',
params: {
zone: '2eb6bd58-865c-47ce-af7f-a918108c3fd2' // REQUIRED zone oid
}
}
]
}, {
Expand Down
72 changes: 72 additions & 0 deletions integrationExamples/gpt/x-domain/creative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<script>
// this script can be returned by an ad server delivering a cross domain iframe, into which the
// creative will be rendered, e.g. DFP delivering a SafeFrame

var urlParser = document.createElement('a');
urlParser.href = '%%PATTERN:url%%';
var publisherDomain = urlParser.protocol + '//' + urlParser.hostname;
var adServerDomain = 'https://tpc.googlesyndication.com';

function renderAd(ev) {
var key = ev.message ? 'message' : 'data';
var adObject = {};
try {
adObject = JSON.parse(ev[key]);
} catch (e) {
return;
}

var origin = ev.origin || ev.originalEvent.origin;
if (adObject.message && adObject.message === 'Prebid Response' &&
publisherDomain === origin &&
adObject.adId === '%%PATTERN:hb_adid%%' &&
(adObject.ad || adObject.adUrl)) {
var body = window.document.body;
var ad = adObject.ad;
var url = adObject.adUrl;
var width = adObject.width;
var height = adObject.height;

if (adObject.mediaType === 'video') {
console.log('Error trying to write ad.');
} else

if (ad) {
var frame = document.createElement('iframe');
frame.setAttribute('FRAMEBORDER', 0);
frame.setAttribute('SCROLLING', 'no');
frame.setAttribute('MARGINHEIGHT', 0);
frame.setAttribute('MARGINWIDTH', 0);
frame.setAttribute('TOPMARGIN', 0);
frame.setAttribute('LEFTMARGIN', 0);
frame.setAttribute('ALLOWTRANSPARENCY', 'true');
frame.setAttribute('width', width);
frame.setAttribute('height', height);
body.appendChild(frame);
frame.contentDocument.open();
frame.contentDocument.write(ad);
frame.contentDocument.close();
} else if (url) {
body.insertAdjacentHTML('beforeend', '<IFRAME SRC="' + url + '" FRAMEBORDER="0" SCROLLING="no" MARGINHEIGHT="0" MARGINWIDTH="0" TOPMARGIN="0" LEFTMARGIN="0" ALLOWTRANSPARENCY="true" WIDTH="' + width + '" HEIGHT="' + height + '"></IFRAME>');
} else {
console.log('Error trying to write ad. No ad for bid response id: ' + id);
}
}
}

function requestAdFromPrebid() {
var message = JSON.stringify({
message: 'Prebid Request',
adId: '%%PATTERN:hb_adid%%',
adServerDomain: adServerDomain
});
window.parent.postMessage(message, publisherDomain);
}

function listenAdFromPrebid() {
window.addEventListener('message', renderAd, false);
}

listenAdFromPrebid();
requestAdFromPrebid();
</script>
56 changes: 0 additions & 56 deletions integrationExamples/gpt/x-domain/creative.js

This file was deleted.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prebid.js",
"version": "0.18.0",
"version": "0.19.0",
"description": "Header Bidding Management Library",
"main": "src/prebid.js",
"scripts": {
Expand Down Expand Up @@ -100,5 +100,8 @@
"webpack-stream": "^3.1.0",
"yargs": "^1.3.1"
},
"dependencies": {}
"dependencies": {
"array-includes": "^3.0.2",
"array.prototype.find": "^2.0.3"
}
}
5 changes: 3 additions & 2 deletions src/adapters/adform.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var utils = require('../utils.js');
var adloader = require('../adloader.js');
var bidmanager = require('../bidmanager.js');
var bidfactory = require('../bidfactory.js');
var STATUSCODES = require('../constants.json').STATUS;

function AdformAdapter() {

Expand Down Expand Up @@ -70,7 +71,7 @@ function AdformAdapter() {
if (adItem && adItem.response === 'banner' &&
verifySize(adItem, bid.sizes)) {

bidObject = bidfactory.createBid(1);
bidObject = bidfactory.createBid(STATUSCODES.GOOD, bid);
bidObject.bidderCode = bidder;
bidObject.cpm = adItem.win_bid;
bidObject.cur = adItem.win_cur;
Expand All @@ -80,7 +81,7 @@ function AdformAdapter() {
bidObject.dealId = adItem.deal_id;
bidmanager.addBidResponse(bid.placementCode, bidObject);
} else {
bidObject = bidfactory.createBid(2);
bidObject = bidfactory.createBid(STATUSCODES.NO_BID, bid);
bidObject.bidderCode = bidder;
bidmanager.addBidResponse(bid.placementCode, bidObject);
}
Expand Down
31 changes: 25 additions & 6 deletions src/adapters/adkernel.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const AdKernelAdapter = function AdKernelAdapter() {
const _dispatch = {};
const originalBids = {};
const site = createSite();
const syncedHostZones = {};

//translate adunit info into rtb impression dispatched by host/zone
this.addImp = function (bid) {
Expand All @@ -48,16 +49,34 @@ const AdKernelAdapter = function AdKernelAdapter() {
//save rtb impression for specified ad-network host and zone
_dispatch[host][zone].push(imp);
originalBids[bidId] = bid;
//perform user-sync
if (!(host in syncedHostZones)){
syncedHostZones[host] = [];
}
if (syncedHostZones[host].indexOf(zone) === -1) {
syncedHostZones[host].push(zone);
insertUserSync(host, zone);
}
};

function insertUserSync(host, zone) {
var iframe = utils.createInvisibleIframe();
iframe.src = `//${host}/user-sync?zone=${zone}`;
try {
document.body.appendChild(iframe);
} catch (error) {
utils.logError(error);
}
}

/**
* Main function to get bid requests
*/
this.dispatch = function (callback) {
utils._each(_dispatch, (zones, host) => {
utils.logMessage('processing network ' + host);
utils.logMessage(`processing network ${host}`);
utils._each(zones, (impressions, zone) => {
utils.logMessage('processing zone ' + zone);
utils.logMessage(`processing zone ${zone}`);
dispatchRtbRequest(host, zone, impressions, callback);
});
});
Expand Down Expand Up @@ -106,7 +125,7 @@ const AdKernelAdapter = function AdKernelAdapter() {
* Build ad-network specific endpoint url
*/
function buildEndpointUrl(host) {
return window.location.protocol + '//' + host + '/rtbg';
return `${window.location.protocol}//${host}/rtbg`;
}

function buildRequestParams(zone, rtbReq) {
Expand Down Expand Up @@ -134,7 +153,7 @@ const AdKernelAdapter = function AdKernelAdapter() {
//process individual bids
utils._each(bids, (bid) => {
if (!validateBidParams(bid.params)) {
utils.logError('Incorrect configuration for adkernel bidder:', bid.params);
utils.logError(`Incorrect configuration for adkernel bidder: ${bid.params}`);
bidmanager.addBidResponse(bid.placementCode, createEmptyBidObject(bid));
} else {
dispatcher.addImp(bid);
Expand All @@ -144,10 +163,10 @@ const AdKernelAdapter = function AdKernelAdapter() {
dispatcher.dispatch((bid, imp, bidResp) => {
let adUnitId = bid.placementCode;
if (bidResp) {
utils.logMessage('got response for ' + adUnitId);
utils.logMessage(`got response for ${adUnitId}`);
bidmanager.addBidResponse(adUnitId, createBidObject(bidResp, bid, imp.banner.w, imp.banner.h));
} else {
utils.logMessage('got empty response for ' + adUnitId);
utils.logMessage(`got empty response for ${adUnitId}`);
bidmanager.addBidResponse(adUnitId, createEmptyBidObject(bid));
}
});
Expand Down
Loading

0 comments on commit 73af74d

Please sign in to comment.