Use iframe tags

Please note that this feature is only for publishers using Google Ad Manager tags. When you are using Google Publisher Tags (GPT), your ads will automatically load into iframes.

Instead of JavaScript, you can use iframe tagging, which is available upon request. With iframe tagging, you'll define ad units only in the FillSlot calls, not in the header of the page. Also, iframe tags will load independently of page content so that your ads won't have to wait for your page to load before being displayed.

Using iframe tags may cause conflicts with Rich Media, AdSense and page formatting. For assistance with iframe tags, please contact us.

Tagging with iframes enables you to use the same header tag on all of your pages. Additionally, any latency issues that you're experiencing should improve when using iframes, since the ads will be loading independently of the page content. DFP Small Business iframe tags do not require that your ad slots be defined in the header of the page, but the slots must be defined in the FillSlot calls.

Please be aware of the following limitations when using iframe tags:

  • Rich Media expandable ads will not function properly with iframe tags, page formatting will be disrupted if there is no ad to be served and AdSense page view stats can get thrown off.

  • You may experience latency from third-party ads when utilising the iframe tagging feature; this latency is independent of the coding within DFP.

  • Be aware that you cannot run both our default tags and iframe tags on the same page. However, you can have different tagging styles on different pages of your site.

  • It is recommended that you test the iframe tags on a few pages of your site to compare the performance against our default tags before you re-tag your entire site.

If you understand these limitations and are still interested in using iframe tags, let us know and we can enable this feature for you. Please note that the support team will be unable to help you implement iframe tagging or troubleshoot any issues that you have due to the complexity and variability in implementation between publishers.

Preparing a page to serve ads in an iframe with DFP Small Business requires distinct blocks of JavaScript, described below. Do not combine JavaScript blocks, or your code may break.

 
Step HTML Description
  <html>
<head>

 

 
Step 1 <script type='text/javascript' src='http://partner.googleadservices.com/gampad/google_service.js'>
</script>

 

Required: Load JavaScript files used by DFP Small Business.
Step 2 <script type='text/javascript'>
    GS_googleAddAdSenseService("ca-pub1");
    GS_googleEnableAllServices();
</script>

 

Required: Enable your page to display ads.
Step 3 <script language="JavaScript">
    GA_googleAddAttr("Gender", "Male");
    GA_googleAddAttr("AgeRange", "18To24");
    GA_googleAddAttr("InterestArea", "cars");
</script>

 

Optional: Set page-level attributes that influence ad selection. Arguments are case sensitive (example: 'male' isn't the same as 'Male').
Step 4 <script type='text/javascript'>
    GA_googleUseIframeRendering();
    GA_googleAddAdSensePageAttr("google_colour_bg", "F0F0F0");
    GA_googleAddAdSenseSlotAttr("AdUnitName", "google_colour_bg", "F0F0F0");
</script>

 

  • (Required) GA_googleUseIframeRending: Enable iframe rendering
  • (Optional) GA_googleAddAdSensePageAttr: For pages that serve AdSense ads, you may pass AdSense parameters to all ad units that appear on a page.
  • (Optional) GA_googleAddAdSenseSlotAttr: For Adunits that serve AdSense ads, you may pass AdSense parameters and values to a particular unit.
  </head>

 

<body>
  <h1> Title of your Page</h1>

 

 
Step 5 <!-- test -->
<script type='text/javascript'>
    GA_googleFillSlotWithSize("ca-pub1", "Ad_Unit_Name", 300, 250);
</script>

 

Required (once per ad unit): Display ads.
  <Normal content of your web page.>

 


</body>
</html>