Skip to content

Instantly share code, notes, and snippets.

@mrpbennett
Last active February 16, 2021 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrpbennett/c9afc59377829289416b564745c89623 to your computer and use it in GitHub Desktop.
Save mrpbennett/c9afc59377829289416b564745c89623 to your computer and use it in GitHub Desktop.
APS Basic Integration
<!-- GPT -->
<script>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function () {
googletag
.defineSlot(
"/116082170/Cottam_Test_UAM_300x250",
[[300, 250]],
"div-gpt-ad-1597628650184-0"
)
.addService(googletag.pubads());
googletag.pubads().disableInitialLoad();
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
<!-- APS -->
<script>
//Load the APS JavaScript Library
!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(){},targetingKeys:function(){return[]},_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");
apstag.init({
pubID: "PUBLISHER_ID_GOES_HERE",
adServer: "googletag",
});
apstag.fetchBids(
{
slots: [
{
slotID: "xxx", // eg: div-gpt-ad-1597628650184-0
slotName: "xxx", // eg: /116082170/Cottam_Test_UAM_300x250
sizes: [[300, 250]],
},
],
},
function (bids) {
googletag.cmd.push(function () {
apstag.setDisplayBids();
googletag.pubads().refresh();
});
}
);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment