Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ybootin/c8e9e7d8449dad9eb1466d6882ba234e to your computer and use it in GitHub Desktop.
Save ybootin/c8e9e7d8449dad9eb1466d6882ba234e to your computer and use it in GitHub Desktop.
Amazon Header Bidding Tag
<script type='text/javascript'>
var slot = null;
googletag.cmd.push(function() {
slot = googletag.defineSlot('/319829355/sim-smp-side-bottom', [300, 250], '...').setTargeting('url', '..').addService(googletag.pubads());
googletag.defineSlot('/319829355/sim-smp-side-bottom-2', [300, 250], '...').setTargeting('url', '...').addService(googletag.pubads());
googletag.defineSlot('/319829355/sim-smp-overlay2', [320, 50], '...').setTargeting('url', '...').addService(googletag.pubads());
googletag.pubads().disableInitialLoad();
googletag.pubads().enableSingleRequest();
googletag.pubads().collapseEmptyDivs();
googletag.enableServices();
});
</script>
<script type='text/javascript'>
/* Amazonヘッダービディング用 */
!function(a9,a,p,s,t,A,g){if(a[a9])return;function q(c,r){a[a9]._Q.push([c,r])}a[a9]={init:function(){q("i",arguments)},fetchBids:function()
{q("f",arguments)},setDisplayBids:function(){},_Q:[]};A=p.createElement(s);A.async=!0;A.src=t;g=p.getElementsByTagName(s)[0];g.parentNode.insertBefore(A,g)}("apstag",window,document,"script","//c.amazon-adsystem.com/aax2/apstag.js");
// initialize apstag and have apstag set bids on the googletag slots when they are returned to the page
apstag.init({ pubID: '3689',
adServer: 'googletag',
bidTimeout: 2e3
});
// request the bids for the four googletag slots
apstag.fetchBids({
slots: [{
slotID: 'div-gpt-ad-1456481258832-8',
slotName: '/319829355/sim-smp-side-bottom',
sizes: [[300, 250]]
}]
}, function(bids) {
// trigger the first request to DFP
googletag.cmd.push(function()
{ apstag.setDisplayBids();
googletag.pubads().refresh([slot]);
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment