Disabling DFP / DoubleClick iFrames

Dyck picture Dyck · Mar 11, 2013 · Viewed 10.4k times · Source

In Google DFP (DoubleClick) you are given an ad code to put in your header and another for your body. When I apply this given ad tag / code to my website, whether its asynchronous or synchronous the ad always displays within an iframe. I'm wondering how I would disable the iFrame.

Here is the generated header code via DFP:

<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('/16569348/ad-test-1', [400, 267], 'div-gpt-ad-1362958263281-    0').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>

Here is the generated body code via DFP:

<!-- ad-test-1 -->
<div id='div-gpt-ad-1362958263281-0' style='width:400px; height:267px;'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1362958263281-0'); });
</script>
</div>

Here is the jsFiddle showcasing this problem (inspect element in google chrome to see iframe):

http://jsfiddle.net/EptwH/

Again, I'd like to remove the iframe (and keep the image / ad of course)... any help would truly be appreciated. :)

Answer

Rob M. picture Rob M. · Mar 11, 2013

From DFP's website: link

When you are using Google Publisher Tags (GPT), your ads will automatically load into iframes.