Understanding DFP ad tags

An ad tag is a piece of HTML or JavaScript code that your webmaster or developer inserts into the source code of a web page. You need to create a separate ad tag for each ad that you want to display on your website.

An ad tag tells DoubleClick for Publishers, ‘I belong to this ad unit. Please send me an ad that matches my targeting criteria and specified sizes.’ The ad server then identifies the best ad for this ad tag, logs an impression, and sends the ad to the ad tag to display on the page.

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.

You can see the relationship between an ad unit and its ad tag in the illustration below.

Note that the ad doesn’t have to match all of the criteria in the ad tag in order to serve. For example, an ad targeted to a top-level ad unit called Sports (that includes no key-values or second-level ad unit targeting) could serve to an ad tag that includes a second-level ad unit and multiple key-values. As long as the targeting criteria in the ad tag matches the criteria for the line item (such as ad unit, key-value, or ad size), an ad will deliver.

I just upgraded to DoubleClick for Publishers. Do I have to update my ad tags?

No. You don’t have to change ad tags that were created before the upgrade. Ads will still deliver to those tags, and you'll still be able to take advantage of many of the upgrade's features such as optimization, forecasting, and the new UI.

However, if you create a new ad unit in the upgraded DFP and want to either modify existing tags or create new tags that use that ad unit, you must add your network code to those tags.

Learn more about generating ad tags.