Skip to content

Instantly share code, notes, and snippets.

@felirosebayobay
Last active October 13, 2020 18:42
Show Gist options
  • Save felirosebayobay/a2a26c8e5f6acb56bce491fb91706b78 to your computer and use it in GitHub Desktop.
Save felirosebayobay/a2a26c8e5f6acb56bce491fb91706b78 to your computer and use it in GitHub Desktop.
GAM Tags Onpage - TC template
Header:
<script type="text/javascript">
window.__afterTrafficQualityExecute = function() {
window.googletag = window.googletag || {cmd: []};
googletag.cmd.push(function() {
googletag.defineSlot('/123456/ad1', [[300,250]], 'div-gpt-ad-9865194-1')
.addService(googletag.pubads());
googletag.defineSlot('/123456/ad2', [[728,90]], 'div-gpt-ad-9865194-2')
.addService(googletag.pubads());
googletag.defineSlot('/123456/ad3', [[728,90]], 'div-gpt-ad-9865194-3')
.addService(googletag.pubads());
googletag.defineSlot('/123456/ad4', [[300,250],[300,600]], 'div-gpt-ad-9865194-4')
.addService(googletag.pubads());
googletag.defineSlot('/123456/ad5', [[728,90],[970,250]], 'div-gpt-ad-9865194-5')
.addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
googletag.display('div-gpt-ad-9865194-1');
googletag.display('div-gpt-ad-9865194-2');
googletag.display('div-gpt-ad-9865194-3');
googletag.display('div-gpt-ad-9865194-4');
googletag.display('div-gpt-ad-9865194-5');
});
};
</script>
<script src="//m2d.m2.ai/PUB_CONFIG.js" type="text/javascript"></script>
Implement before the closing </body> or footer, or can be anywhere on page:
<script type="text/javascript" src="//cdn.pubguru.com/fb.js"></script>
Body:
<div id='div-gpt-ad-9865194-1'></div>
<div id='div-gpt-ad-9865194-2'></div>
<div id='div-gpt-ad-9865194-3'></div>
<div id='div-gpt-ad-9865194-4'></div>
<div id='div-gpt-ad-9865194-5'></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment