Skip to content

Instantly share code, notes, and snippets.

@anderly
Last active March 13, 2017 16:34
Show Gist options
  • Save anderly/ec7f930f813bcaeff422 to your computer and use it in GitHub Desktop.
Save anderly/ec7f930f813bcaeff422 to your computer and use it in GitHub Desktop.
DFP Interstitial Ad Code
<script>
var DmagInterstitialAd = DmagInterstitialAd || {};
DmagInterstitialAd.showInterstitial = true;
DmagInterstitialAd.adWidth = 720;
DmagInterstitialAd.adHeight = 480;
DmagInterstitialAd.destinationURL = "http://ad.doubleclick.net/ddm/trackclk/N5716.759086CENTRO.NET/B8239828.110882020;dc_trk_aid=283955045;dc_trk_cid=59150503";
DmagInterstitialAd.embedCode = '<img src="http://ad.doubleclick.net/ddm/trackimp/N5716.759086CENTRO.NET/B8239828.110882020;dc_trk_aid=283955045;dc_trk_cid=59150503;ord=[timestamp]?" border="0" height="1" width="1" alt="Advertisement">';
/*-------------------------------------------------------------------------------------------------------*/
/* DO NOT MODIFY CODE BELOW */
/*-------------------------------------------------------------------------------------------------------*/
DmagInterstitialAd.clickThroughURL = "%%CLICK_URL_UNESC%%" + DmagInterstitialAd.destinationURL;
(function () {
var d=document,
h=d.getElementsByTagName('head')[0],
s=d.createElement('script');
s.type='text/javascript';
s.async=true;
s.src='/content/assets/scripts/footer/dmag.interstitial-ad.js';
h.appendChild(s);
}());
</script>
@expatRene
Copy link

Hi, Does this code work for async tag?
Let say if we want to run an interstitial ad and we're using async:

<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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment