Skip to content

Instantly share code, notes, and snippets.

@barisusakli
Last active December 29, 2015 17:30
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save barisusakli/a1ff2ac801c6d716169c to your computer and use it in GitHub Desktop.
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