Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
google DFP widget ad code
//this goes in <head>
<script type='text/javascript'>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
(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);
})();
</script>
<script type='text/javascript'>
googletag.cmd.push(function() {
googletag.defineSlot('/80273159/nodebbtest', [160, 600], 'div-gpt-ad-1451410127852-0').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
// below goes in body
<!-- /80273159/nodebbtest -->
<div id='div-gpt-ad-1451410127852-0' style='height:600px; width:160px;'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1451410127852-0'); });
</script>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment