Skip to content

Commit

Permalink
Index Exchange Bid Adapter: bidder params.size not required; read vid…
Browse files Browse the repository at this point in the history
…eo parameters from ad unit (#6691)

* not relying on ix bidder params.size, reading from ad unit level mediaTypes

* video impression should have size

* deprecating params.size, reading mediaTypes.video

* mediaTypes.video.[w/h] + update the documentation

* Updating the documentation examples

* addressing Mikes feedback

* IE-11 does not support object.entries()

* cleaning up the video params check
  • Loading branch information
punkiller authored Jun 8, 2021
1 parent d496c68 commit 6dd4c8f
Show file tree
Hide file tree
Showing 4 changed files with 419 additions and 210 deletions.
117 changes: 117 additions & 0 deletions integrationExamples/gpt/ixMultiFormat.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<!--
This page calls a single bidder for a single ad slot.
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 async src="../../build/dist/prebid.js"></script>
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
<script>
var FAILSAFE_TIMEOUT = 3300;
var PREBID_TIMEOUT = 1000;
var adUnits = [{
code: 'div-gpt-ad-51545-0',
mediaTypes: {
banner: {
sizes: [[300, 250], [600, 500]]
},
video: {
playerSize : [300,250],
mimes : ["video/x-ms-wmv", "video/mp4"],
minduration : 0,
maxduration: 3,
protocols : [1,2]
}
},
// Replace this object to test a new Adapter!
bids: [{
bidder: 'ix',
params: {
// only siteId required
siteId: '300'
}
}]
}];
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
</script>
<script>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function () {
googletag.pubads().disableInitialLoad();
});

pbjs.que.push(function () {
pbjs.addAdUnits(adUnits);
pbjs.setConfig({
floors: {
enforcement: {
floorDeals: false, //default to false
bidAdjustment: true
},
data: { // default if endpoint doesn't return in time
currency: 'USD',
skipRate: 5,
modelVersion: 'BlackBerryZap',
schema: {
fields: ['gptSlot', 'mediaType', 'size']
},
values: {
'*|banner|600x500': 6.5,
'*|banner|300x250': 3.25,
'*|video': 3.5
}
}
}
});
pbjs.requestBids({
bidsBackHandler: sendAdserverRequest,
timeout: PREBID_TIMEOUT
});
});

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();
}, FAILSAFE_TIMEOUT);

</script>

<script>
googletag.cmd.push(function () {
googletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-gpt-ad-51545-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-51545-0'>
<script type='text/javascript'>
googletag.cmd.push(function () { googletag.display('div-gpt-ad-51545-0'); });
</script>
</div>
</body>

</html>

Loading

0 comments on commit 6dd4c8f

Please sign in to comment.