Configure Google Ad Manager tags

This article describes how to configure Google Ad Manager (GAM) tags. To take advantage of the latest features of DFP Small Business, upgrade your tags to Google Publisher tags (GPT).
 

Preparing pages to serve ads

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 language="JavaScript" src="http://partner.googleadservices.com/gampad/google_service.js">
</script>

 

Required: Load JavaScript files used by DFP Small Business.
Step 2 <script language="JavaScript" 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 language="JavaScript">
    GA_googleAddSlot("ca-pub1", "GizmosUnlimited_HelpCenter_FAQs_ATF_Left_90x90");
    GA_googleAddAdSensePageAttr("google_color_bg", "F0F0F0");
    GA_googleAddAdSenseSlotAttr("AdUnitName", "google_color_bg", "F0F0F0");
</script>
  • (Required) GA_googleAddSlot: Define the ad units on your page. This example uses a fictitious ad unit name ("GizmosUnlimited...") described in Choosing a Naming Convention.
  • (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.
Step 5 <script language="JavaScript">
    GA_googleFetchAds();
</script>

 

Required: Retrieve the ads for your page.
 

</head>

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

 

 
Step 6 <script language="JavaScript">
        GA_googleFillSlot("GizmosUnlimited_HelpCenter_FAQs_ATF_Left_90x90");
 </script>

 

Required (once per ad unit): Display Ads
 

<p>Normal content of your Web page.</p>

</body>
</html>

 
 

Using the GA_googleAddSlot call

You must define each ad unit that appears on your page. Your page will call the GA_googleAddSlot function once for each ad unit appearing on the page. The following code sample is for a page containing three ad units; the GA_googleAddSlot function is called three times:
 

<script language="JavaScript">
   GA_googleAddSlot ("ca-pub1", "GizmosUnlimited_Products_HotPick_ATF_TopBanner_728x90");
   GA_googleAddSlot ("ca-pub1", "GizmosUnlimited_Products_HotPick_BTF_BottomBanner_728x90");
   GA_googleAddSlot ("ca-pub1", "GizmosUnlimited_Products_HotPick_BTF_Box_90x90");
</script>

If you don't want to define your ad units in the header of the page, iframe tagging is available upon request. With iframe tagging, you'll define ad units only in the FillSlot calls. For assistance with iframe tags, please contact us.

 

Where to put GAM tags

We strongly recommend that you place all of your tags prior to the FillSlot calls in the <body> section of the code. As long as the other tags come before the first FillSlot call, your tags will function.

 

Learn how to generate ad unit tags.