Clear search
Close search
Google apps
Main menu

Generate ad tags

The DFP Small Business tag generator can automatically generate the HTML and JavaScript necessary to integrate one or more ad units on a page. Using the ad tag generator is optional, but generally easier and less error-prone than manually rewriting code.

Note: For an app, instead of an ad tag, you can use Google Mobile Ads SDK in most situations. Learn more in the Google developers documentation and in the DFP Help Center.

If you want to do in-stream video for apps, you can use the IMA SDK, and we also recommend the use of Google Publisher tags.

To generate tags for one or more ad units:

  1. In your DFP Small Business account, click the Inventory tab.

  2. Click Generate tags on the left-hand panel.

  3. In the "Target platform" list, select whether you want to generate tags for the web or for mobile devices.

  4. Select ad units by clicking include next to the appropriate ad unit names. (You can generate tags for all ad units at once or page by page.)

  5. Click Generate tags. The "Generated tags" screen displays.

  6. Select the type of tag you want:

    • Google Publisher Tag: Select whether you want to use single request mode, synchronous requests, or both. See The Google Publisher Tag Help Center topic for more information.

    • You can choose between Standard GPT passback or GPT Light passback syntax. GPT Light passback tags are optimized for speed, while retaining most of the features of Standard GPT passbacks. Learn more about GPT Light passback tags

    • Google Ad Manager tag: Select this if you haven't upgraded to Google Publisher Tags (GPT).

    Text fields with the full HTML for the header and body of the page, including the selected ad units, displays.

  7. Copy the code and place it in the HTML of the appropriate pages.

Div IDs in Google Publisher Tags

The div IDs must be consistent between a web page header and body as well as unique for the page so that there's no ambiguity about where the GPT script will place the ad once it receives the response from the ad server.

The tag generator randomly generates div IDs to ensure they are unique for that page. However, you can manually label div IDs with something more intuitive, for example, leaderboard-1, right-300x250 as long as you ensure that the ID is only used once on a particular page.

Was this article helpful?