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

* commit '7a81386579a3c129617323ef32e1c8be0897c3c7': (31 commits)
  Added changelog entry.
  Added records in aolPartnersIds.json.
  Prebid 0.25.0 Release
  Added Unruly adapter (prebid#1264)
  Fixing Adyoulike adapter for Safari iOS7 (prebid#1296)
  hide overflow to prevent scrolling (prebid#1294)
  fix protocol detection in iframe (prebid#1293)
  Add eplanning adapter (prebid#1245)
  Use Renderer command queue to render outstream (prebid#1283)
  Generate no-bid response for ech bid request not matched by a bid (prebid#1216)
  New Cox adapter (prebid#1228)
  Carambola Adapter (prebid#1221)
  Pass through transactionId and set fd=1 (prebid#1259)
  Integration test page for adapters (prebid#1182)
  Getting DigiTrustID in GumGum adapter (prebid#1256)
  Trion adapter (prebid#1254)
  use request bidder code as default bidderCode for createBid (prebid#1235)
  Add drop pixels once feature to AOL Adapter (prebid#1224)
  Rubicon Adapter - Adding 320x150 (prebid#1279)
  Prevent 'about:' protocol in _publisherTagUrl (prebid#1170)
  ...
  • Loading branch information
vzhukovsky committed Jul 18, 2017
2 parents ea3bf0f + 7a81386 commit 711ffb3
Show file tree
Hide file tree
Showing 44 changed files with 2,792 additions and 149 deletions.
3 changes: 3 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ Thank you for your pull request. Please make sure this PR is scoped to one chang
}
}
```

Be sure to test the integration with your adserver using the [Hello World](/integrationExamples/gpt/hello_world.html) sample page.

- contact email of the adapter’s maintainer
- [ ] official adapter submission

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.24.0
----------------
Updated to Prebid 0.25.0


AOL Prebid 1.23.0
----------------
Added passing key values feature.
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Before a Pull Request will be considered for merge:
- All new and existing tests must pass
- Added or modified code must have greater than 80% coverage

If you are submitting an adapter, you can also use the [Hello World](integrationExamples/gpt/hello_world.html) example page to test integration with your server.

### Test Guidelines
When you are adding code to Prebid.js, or modifying code that isn't covered by an existing test, test the code according to these guidelines:

Expand Down
14 changes: 14 additions & 0 deletions adapters.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
"adform",
"adkernel",
"admedia",
"adyoulike",
"bidfluence",
"vertamedia",
"aol",
"appnexus",
"appnexusAst",
"beachfront",
"audienceNetwork",
"carambola",
"conversant",
"districtmDMX",
"fidelity",
Expand Down Expand Up @@ -66,8 +68,10 @@
"atomx",
"tapsense",
"trion",
"eplanning",
"prebidServer",
"adsupply",
"cox",
{
"aol": {
"alias": "onemobile"
Expand Down Expand Up @@ -153,5 +157,15 @@
"rhythmone": {
"supportedMediaTypes": ["video"]
}
},
{
"admixer": {
"supportedMediaTypes": ["video"]
}
},
{
"conversant": {
"supportedMediaTypes": ["video"]
}
}
]
5 changes: 2 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ gulp.task('clean', function () {
.pipe(clean());
});

gulp.task('devpack', function () {
gulp.task('devpack', ['clean'], function () {
webpackConfig.devtool = 'source-map';
const analyticsSources = helpers.getAnalyticsSources(analyticsDirectory);
return gulp.src([].concat(analyticsSources, 'src/prebid.js'))
Expand Down Expand Up @@ -201,12 +201,11 @@ gulp.task('watch', function () {
'src/**/*.js',
'test/spec/**/*.js',
'!test/spec/loaders/**/*.js'
], ['lint', 'webpack', 'devpack', 'test']);
], ['clean', 'lint', 'webpack', 'devpack', 'test']);
gulp.watch([
'loaders/**/*.js',
'test/spec/loaders/**/*.js'
], ['lint', 'mocha']);
gulp.watch(['integrationExamples/gpt/*.html'], ['test']);
connect.server({
https: argv.https,
port: port,
Expand Down
1 change: 0 additions & 1 deletion integrationExamples/gpt/.gitignore

This file was deleted.

102 changes: 102 additions & 0 deletions integrationExamples/gpt/hello_world.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<!--
This page calls a single bidder for a single ad slot. It can be considered a "hello world" example for using
Prebid with the Google Publisher Tag.
It also makes a good test page for new adapter PR submissions. Simply set your server's Bid Params object in the
bids array inside the adUnits, and it will use your adapter to load an ad.
NOTE that many ad servers won't send back an ad if the URL is localhost... so you might need to
set an alias in your /etc/hosts file so that you can load this page from a different domain.
-->

<html>
<head>
<script>
var PREBID_TIMEOUT = 700;

var adUnits = [{
code: 'div-gpt-ad-1460505748561-0',
sizes: [[300, 250], [300,600]],

// Replace this object to test a new Adapter!
bids: [{
bidder: 'appnexus',
params: {
placementId: '10433394'
}
}]

}];

var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];

</script>

<script type="text/javascript" src="../../build/dev/prebid.js" async></script>
<script>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function() {
googletag.pubads().disableInitialLoad();
});

pbjs.que.push(function() {
pbjs.addAdUnits(adUnits);
pbjs.requestBids({
bidsBackHandler: sendAdserverRequest
});
});

function sendAdserverRequest() {
if (pbjs.adserverRequestSent) return;
pbjs.adserverRequestSent = true;
googletag.cmd.push(function() {
pbjs.que.push(function() {
pbjs.setTargetingForGPTAsync();
googletag.pubads().refresh();
});
});
}

setTimeout(function() {
sendAdserverRequest();
}, PREBID_TIMEOUT);

</script>

<script>
(function () {
var gads = document.createElement('script');
gads.async = true;
gads.type = 'text/javascript';
var useSSL = 'https:' == document.location.protocol;
gads.src = (useSSL ? 'https:' : 'http:') +
'//www.googletagservices.com/tag/js/gpt.js';
var node = document.getElementsByTagName('script')[0];
node.parentNode.insertBefore(gads, node);
})();
</script>

<script>
googletag.cmd.push(function () {
googletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-gpt-ad-1460505748561-0').addService(googletag.pubads());

googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
</head>

<body>
<h2>Prebid.js Test</h2>
<h5>Div-1</h5>
<div id='div-gpt-ad-1460505748561-0'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1460505748561-0'); });
</script>
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prebid.js",
"version": "0.24.1",
"version": "0.25.0",
"description": "Header Bidding Management Library",
"main": "src/prebid.js",
"scripts": {
Expand Down
42 changes: 37 additions & 5 deletions src/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,37 @@ import { loadScript } from 'src/adloader';
import * as utils from 'src/utils';

export function Renderer(options) {
const { url, config, id, callback } = options;
const { url, config, id, callback, loaded } = options;
this.url = url;
this.config = config;
this.callback = callback;
this.handlers = {};
this.id = id;

// a renderer may push to the command queue to delay rendering until the
// render function is loaded by loadScript, at which point the the command
// queue will be processed
this.loaded = loaded;
this.cmd = [];
this.push = func => {
if (typeof func !== 'function') {
utils.logError('Commands given to Renderer.push must be wrapped in a function');
return;
}
this.loaded ? func.call() : this.cmd.push(func);
};

// bidders may override this with the `callback` property given to `install`
this.callback = callback || (() => {
this.loaded = true;
this.process();
});

// we expect to load a renderer url once only so cache the request to load script
loadScript(url, callback, true);
loadScript(url, this.callback, true);
}

Renderer.install = function({ url, config, id, callback }) {
return new Renderer({ url, config, id, callback });
Renderer.install = function({ url, config, id, callback, loaded }) {
return new Renderer({ url, config, id, callback, loaded });
};

Renderer.prototype.getConfig = function() {
Expand All @@ -36,3 +54,17 @@ Renderer.prototype.handleVideoEvent = function({ id, eventName }) {

utils.logMessage(`Prebid Renderer event for id ${id} type ${eventName}`);
};

/*
* Calls functions that were pushed to the command queue before the
* renderer was loaded by `loadScript`
*/
Renderer.prototype.process = function() {
while (this.cmd.length > 0) {
try {
this.cmd.shift().call();
} catch (error) {
utils.logError('Error processing Renderer command: ', error);
}
}
};
9 changes: 6 additions & 3 deletions src/adapters/adform.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ function AdformAdapter() {
};

function _callBids(params) {
var bid, _value, _key, i, j, k, l;
var bid, _value, _key, i, j, k, l, reqParams;
var bids = params.bids;
var request = [];
var callbackName = '_adf_' + utils.getUniqueIdentifierStr();
var globalParams = [ [ 'adxDomain', 'adx.adform.net' ], [ 'url', null ], [ 'tid', null ], [ 'callback', '$$PREBID_GLOBAL$$.' + callbackName ] ];
var globalParams = [ [ 'adxDomain', 'adx.adform.net' ], ['fd', 1], [ 'url', null ], [ 'tid', null ], [ 'callback', '$$PREBID_GLOBAL$$.' + callbackName ] ];

for (i = 0, l = bids.length; i < l; i++) {
bid = bids[i];
Expand All @@ -28,7 +28,9 @@ function AdformAdapter() {
}
}

request.push(formRequestUrl(bid.params));
reqParams = bid.params;
reqParams.transactionId = bid.transactionId;
request.push(formRequestUrl(reqParams));
}

request.unshift('//' + globalParams[0][1] + '/adx/?rp=4');
Expand Down Expand Up @@ -76,6 +78,7 @@ function AdformAdapter() {
bidObject.width = adItem.width;
bidObject.height = adItem.height;
bidObject.dealId = adItem.deal_id;
bidObject.transactionId = bid.transactionId;
bidmanager.addBidResponse(bid.placementCode, bidObject);
} else {
bidObject = bidfactory.createBid(STATUSCODES.NO_BID, bid);
Expand Down
20 changes: 18 additions & 2 deletions src/adapters/admixer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var utils = require('../utils.js');
*/
var AdmixerAdapter = function AdmixerAdapter() {
var invUrl = '//inv-nets.admixer.net/prebid.aspx';
var invVastUrl = '//inv-nets.admixer.net/videoprebid.aspx';

function _callBids(data) {
var bids = data.bids || [];
Expand All @@ -21,7 +22,16 @@ var AdmixerAdapter = function AdmixerAdapter() {
'callback_uid': bid.placementCode
};
if (params.zone) {
_requestBid(invUrl, params);
if (bid.mediaType === 'video') {
var videoParams = {};
if (typeof bid.video === 'object') {
Object.assign(videoParams, bid.video);
}
Object.assign(videoParams, params);
_requestBid(invVastUrl, params);
} else {
_requestBid(invUrl, params);
}
} else {
var bidObject = bidfactory.createBid(2);
bidObject.bidderCode = 'admixer';
Expand All @@ -48,7 +58,13 @@ var AdmixerAdapter = function AdmixerAdapter() {
bidObject = bidfactory.createBid(1);
bidObject.bidderCode = 'admixer';
bidObject.cpm = bid.cpm;
bidObject.ad = bid.ad;
if (bid.vastUrl) {
bidObject.mediaType = 'video';
bidObject.vastUrl = bid.vastUrl;
bidObject.descriptionUrl = bid.vastUrl;
} else {
bidObject.ad = bid.ad;
}
bidObject.width = bid.width;
bidObject.height = bid.height;
} else {
Expand Down
Loading

0 comments on commit 711ffb3

Please sign in to comment.