Clear search
Close search
Google apps
Main menu

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


Step 1 <script language="JavaScript" src="">


Required: Load JavaScript files used by DFP Small Business.
Step 2 <script language="JavaScript" type="text/javascript">


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


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("AdUnitCode", "google_color_bg", "F0F0F0");
  • (Required) GA_googleAddSlot: Define the ad units on your page. This example uses a fictitious ad unit code ("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">


Required: Retrieve the ads for your page.


<h1>Title of your Page</h1>


Step 6 <script language="JavaScript">


Required (once per ad unit): Display Ads

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



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");

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.

Was this article helpful?