Search
Clear search
Close search
Google apps
Main menu

DFP Tags Generator

Using the DFP Tags Generator, you can easily customize and generate ad tags without having to manually edit the code. The tag generator is suitable for all DFP publishers. Some of the primary features are:

  • Include custom page-level or slot-level targeting to tags
  • Include custom sizes for ad tags
  • Create tags for out-of-page campaigns

Define GPT and ad slot settings

  1. Select your DFP product type.
  2. Enter your network ID.
  3. Select your tag type.
    If an ad unit has both video and display ad sizes, the tag generated by the Tag Generator will contain a mix of sizes for both video and display.
    • Async: Instructs the service to fetch ads asynchronously using iframes in the publisher's domain. We recommend this as the most user-friendly tagging option. Learn more
    • Sync: Instructs the service to wait for ad requests to complete before continuing with page rendering. Learn more
    • Sync passback: Generates a passback tag to be used on third-party ad servers. Learn more
      • Some of the GPT options are not available with this setting, and will collapse in the setting menu.
      • Passback ad tags allow you to set a click tracker URL, located in the "Ad slot(s)" section.
    • Simplified URL (non JS): Generates a non-JavaScript ad call, equivalent to an /AD/ DFP legacy ad tag. Learn more
      • Some of the GPT options are not available with this setting, and will collapse in the setting menu.
  4. (Optional) Enter any page-level key-values.
    • Only available for syncronous and asynchronous tag types
    • These key-values are applied to all of the ad units on the page. Learn more
    • Enter the key-value as key=value
    • Multiple key-values should be separated by a comma
    • If a key has multiple values, use the format key=[value1;value2;...;valueX]
  5. (Optional) Enter any page level content exclusion labels.
    • Only available for syncronous and asynchronous tag types.
    • Line items with this exclusion label don't serve on any ad slot of the page. Learn more
  6. (Optional) Select any optional GPT settings
    • Single request: Requests all ad slot contents in a single request. Learn more
    • Out-of-page ad unit: Constructs an out-of-page (interstitial) ad slot with the given ad unit name. Learn more
    • Collapse empty divs: Collapses empty div elements when there is no ad content to display. Learn more
    • Disable initial load: Disables the initial fetch of ads from Google when the page is first loaded. Learn more
    • Disable publisher console: Disables the Google Publisher Console on the current page. Learn more
  7. Enter your ad unit name.
    • Names should be in the format: [level_1]/[level_2]/...[level_X]
  8. Enter your ad unit size(s).
    • Sizes should be in the format: [width]x[height]
    • Multiple sizes should be separated by a comma
    • The out-of-page ad slot size should not be defined here
  9. (Optional) Enter any slot-level key-values.
    • These key-values only apply to this ad unit. Learn more
    • Key-values should be in the format: key=value
    • Multiple key-values should be separated by a comma
    • If a key has multiple values, use the format key=[value1;value2;...;valueX]
  10. (Optional) Enter any slot-level content exclusions.
    • Line items with this exclusion label don't serve to this ad unit. Learn more

Generate and preview ad tags

When you've defined all of your settings, click Submit to generate your ad tags. The header tag and body tags will be shown separately and can be copied by simply clicking either of the "Copy" buttons.

A preview of your ads should appear at the bottom of the page.

Other features

Generate staging: You can generate an HTML test page containing the generated code and a minimal HTML structure containing the ad slot(s). To generate the staging page, simply click Generate staging after generating the tags .

The staging page can be shared via the URL and has an expiration of 30 days from the last visit. Add ?nh=true to the URL to generate a page containing only the ad tags without any additional HTML.

Form method: You can set the form submit method to either GET or POST. The GET method produces a URL that can be shared, but results in a lengthier ad call because the ad server will also receive the URL string of the request. The POST method will result in a shorter ad call, but the request URL cannot be shared.

You can generate tags directly from DFP and manually edit them to include any of the settings shown in this tool. Learn more

Was this article helpful?
How can we improve it?