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

* commit '4d9ade3df767750743f8888ed9efd6c77f8d0050': (26 commits)
  Added changelog entry.
  Added new aol partners ids.
  Prebid 0.28.0 Release
  Revert "Upgrade sinon to 3.x (prebid#1491)" (prebid#1563)
  add () for correct order of operations in scaling increments for currency (prebid#1559)
  AppnexusAst adapter update: Added source and version to request payload (prebid#1555)
  remove unnecessary spread operator (prebid#1561)
  Adxcg adapter (prebid#1554)
  Upgrade sinon to 3.x (prebid#1491)
  Rename vastPayload to vastXml (prebid#1556)
  Single-size sizes array now can be taken, too (prebid#1535)
  Updated the istanbul-instrumenter-loader (prebid#1550)
  Add AerServ Adapter (prebid#1538)
  Fixed imports and made adform support aliasing (prebid#1518)
  Custom granularity fix (prebid#1546)
  Fix `documentation lint` issues (prebid#1544)
  Yieldbot adunit bidder params slot name usage fix (prebid#1394)
  Update serverbid adapter to use smartsync (prebid#1324)
  Add improvedigitalBidAdapter (prebid#1381)
  Fix prebid#1533 spring server typo (prebid#1542)
  ...
  • Loading branch information
vzhukovsky committed Oct 6, 2017
2 parents 7696d78 + 4d9ade3 commit e797d03
Show file tree
Hide file tree
Showing 43 changed files with 3,329 additions and 278 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
AOL Prebid 1.28.0
----------------
Updated to Prebid 0.28.0


AOL Prebid 1.27.0
----------------
Updated Komoona adapter.
Expand Down
2 changes: 1 addition & 1 deletion integrationExamples/gpt/gpt_aliasingBidder.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
// Load the Prebid Javascript Library Async. We recommend loading it immediately after
// the initAdserver() and setTimeout functions.
(function () {
var d = document, pbs = d.createElement("script"), pro = d.location.protocal;
var d = document, pbs = d.createElement("script"), pro = d.location.protocol;
pbs.type = "text/javascript";
pbs.src = '/build/dist/prebid.js';
var target = document.getElementsByTagName("head")[0];
Expand Down
201 changes: 201 additions & 0 deletions integrationExamples/gpt/pbjs_yieldbot_gpt.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
<html>
<head>
<script>
var PREBID_TIMEOUT = 1000;

var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];

function initAdserver() {
if (pbjs.initAdserverSet) return;
(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);
})();
pbjs.initAdserverSet = true;
};
setTimeout(initAdserver, PREBID_TIMEOUT);

var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
(function() {
var pbjsEl = document.createElement("script");
pbjsEl.type = "text/javascript";
pbjsEl.async = true;
pbjsEl.src = "/build/dev/prebid.js";
var pbjsTargetEl = document.getElementsByTagName("head")[0];
pbjsTargetEl.insertBefore(pbjsEl, pbjsTargetEl.firstChild);
})();

pbjs.que.push(function() {
var adUnits = [
{
code: 'div-gpt-ad-1438287399331-0',
sizes: [[728, 90]],
bids: [
{
bidder: 'appnexus',
params: { placementId: '10433394' }
},
{
bidder: 'yieldbot',
params: {
psn: '1234',
slot: 'leaderboard'
}
}
]
},
{
code: 'div-gpt-ad-1438287399331-1',
sizes: [[300, 250], [300, 600]],
bids: [
{
bidder: 'appnexus',
params: { placementId: '10433394' }
},
{
bidder: 'yieldbot',
params: {
psn: '1234',
slot: 'test_slot'
}
}
]
},
{
code: 'div-gpt-ad-1438287399331-2',
sizes: [[300, 250]],
bids: [
{
bidder: 'appnexus',
params: { placementId: '10433394' }
},
{
bidder: 'yieldbot',
params: {
psn: '1234',
slot: 'test_slot'
}
}
]
}
];
pbjs.addAdUnits(adUnits);

pbjs.requestBids({
bidsBackHandler: function(bidResponses) {
initAdserver();
}
})
});
</script>

<script>
var topSlot;
var rightSlot;
var leftSlot;

googletag.cmd.push(function() {
topSlot = googletag.defineSlot('/2476204/leaderboard', [[728, 90]], 'div-gpt-ad-1438287399331-0').addService(googletag.pubads());

rightSlot = googletag.defineSlot('/2476204/multi-size', [[300, 250], [300, 600]], 'div-gpt-ad-1438287399331-1').addService(googletag.pubads());

leftSlot = googletag.defineSlot('/2476204/multi-size', [[300, 250], [300,600]], 'div-gpt-ad-1438287399331-2').addService(googletag.pubads());

pbjs.que.push(function() {
pbjs.setTargetingForGPTAsync();
});

googletag.pubads().collapseEmptyDivs(true);
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});

function refreshBid0() {
pbjs.que.push(function() {
pbjs.requestBids({
timeout: PREBID_TIMEOUT,
adUnitCodes: ['div-gpt-ad-1438287399331-0'],
bidsBackHandler: function() {
pbjs.setTargetingForGPTAsync(['div-gpt-ad-1438287399331-0']);
googletag.pubads().refresh([topSlot]);
}
});
});
}

function refreshBid1() {
pbjs.que.push(function() {
pbjs.requestBids({
timeout: PREBID_TIMEOUT,
adUnitCodes: ['div-gpt-ad-1438287399331-1'],
bidsBackHandler: function() {
pbjs.setTargetingForGPTAsync(['div-gpt-ad-1438287399331-1']);
googletag.pubads().refresh([rightSlot]);
}
});
});
}

function refreshBid2() {
pbjs.que.push(function() {
pbjs.requestBids({
timeout: PREBID_TIMEOUT,
adUnitCodes: ['div-gpt-ad-1438287399331-2'],
bidsBackHandler: function() {
pbjs.setTargetingForGPTAsync(['div-gpt-ad-1438287399331-2']);
googletag.pubads().refresh([leftSlot]);
}
});
});
}
</script>
</head>

<body>
<h2>Prebid.js Yieldbot Adapter Basic Example</h2>
Use the links below to enable and disable Yieldbot test bids.<br>
<br>
<b><em>Note:</em></b>
<br>
The "<b><a href="#enable" target="_self">Enable - Yieldbot Test Bids</a></b>" link below will set a cookie to force Yieldbot bid requests to return static test creative: the cookie expires in 24 hrs.
<br>
<ul><li>Use the "<b><a href="#enable" target="_self">Disable - Yieldbot Test Bids</a></b>" link when testing is complete to re-enable live bids.</li></ul>
<ol>
<li><a id="enable" href="http://i.yldbt.com/m/start-testing" target="_blank">Enable - Yieldbot Test Bids</a></li>
<li><a id="disable" href="http://i.yldbt.com/m/stop-testing" target="_blank">Disable - Yieldbot Test Bids</a></li>
</ol>
<h5>Div-0, 728x90</h5>
<button onclick="refreshBid0()">Refresh 728x90 Ad Unit</button>
<div id='div-gpt-ad-1438287399331-0'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1438287399331-0'); });
</script>
</div>
<h5>Div-1, 300x250 or 300x600</h5>
<button onclick="refreshBid1()">Refresh 300x250, 300x600 Ad Unit</button>
<div id='div-gpt-ad-1438287399331-1'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1438287399331-1'); });
</script>
</div>
<h5>Div-2, 300x250 or 300x600</h5>
The bid for the <code>300x250 | 300x600</code> slot is shown under <b><em>Div-1</em></b> above.
<ul>
<li>Refresh this slot after initial page view and you should see the Yieldbot test creative.</li>
</ul>
<button onclick="refreshBid2()">Refresh 300x250, 300x600 Ad Unit</button>
<div id='div-gpt-ad-1438287399331-2'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1438287399331-2'); });
</script>
</div>
</body>
</html>
26 changes: 15 additions & 11 deletions modules/adformBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
var utils = require('src/utils.js');
var adloader = require('src/adloader.js');
var bidmanager = require('src/bidmanager.js');
var bidfactory = require('src/bidfactory.js');
var utils = require('src/utils');
var adloader = require('src/adloader');
var bidmanager = require('src/bidmanager');
var bidfactory = require('src/bidfactory');
var STATUSCODES = require('src/constants.json').STATUS;
var adaptermanager = require('src/adaptermanager');
var Adapter = require('src/adapter').default;

const ADFORM_BIDDER_CODE = 'adform';

function AdformAdapter() {
return {
callBids: _callBids
};
let baseAdapter = new Adapter(ADFORM_BIDDER_CODE);

function _callBids(params) {
var bid, _value, _key, i, j, k, l, reqParams;
Expand Down Expand Up @@ -47,7 +48,7 @@ function AdformAdapter() {
$$PREBID_GLOBAL$$[callbackName] = handleCallback(bids);

adloader.loadScript(request.join('&'));
}
};

function formRequestUrl(reqData) {
var key;
Expand All @@ -63,7 +64,7 @@ function AdformAdapter() {
function handleCallback(bids) {
return function handleResponse(adItems) {
var bidObject;
var bidder = 'adform';
var bidder = baseAdapter.getBidderCode();
var adItem;
var bid;
for (var i = 0, l = adItems.length; i < l; i++) {
Expand Down Expand Up @@ -160,8 +161,11 @@ function AdformAdapter() {

return utftext;
}
}

adaptermanager.registerBidAdapter(new AdformAdapter(), 'adform');
return Object.assign(this, baseAdapter, {
callBids: _callBids
});
}

adaptermanager.registerBidAdapter(new AdformAdapter(), ADFORM_BIDDER_CODE);
module.exports = AdformAdapter;
Loading

0 comments on commit e797d03

Please sign in to comment.