Custom targeting

Passing key-values into legacy DART ad tags

As of April 5, 2016, DoubleClick for Publishers no longer supports legacy DART tags.

If you are using legacy DART tags, you must re-tag using Google Publisher Tags (GPT) to ensure seamless ad serving on your site(s). Learn more

This article explains how to pass key-values using legacy DART tags. For information about passing key-values with Google Publisher Tags (GPT), see Set targeting and sizes with GPT.

After you've defined key-values in your network, you'll want to target line items to key-values. To serve a line item to an ad slot on your page, you must ensure that the line item is targeted to a key-value and that the ad tag where you want the line item to serve includes the same key-value.

For example, if you want to sell ad slots above the fold at a higher price than ad slots that are lower on the page:

  1. First define key-values to include a key-value for pos=atf, which in this case means that the ad slot's position is above the fold.

  2. On the line item trafficking screen, click Key-values and add the key-value pos=atf to the line item's targeting.

  3. Finally, ensure that the ad tag you want this line item to serve to includes the key-value pos=atf. Here's what the tag could look like:;pos=atf;tile=1;sz=728x90;ord=

If you follow these steps correctly to create and target the key-value and ensure that it appears in the ad tag, the line item will serve to the correct tag on your page (note that run-of-site and run-of-network ads will also continue to deliver to that ad tag).

Add key-values to ad tags

There are two ways that you can include key-values in your ad tags:

  • Hard-code the key-value in your ad tags so that the tag always includes that key-value. In this case, the tags are static and don't change dynamically.

  • Pass the key-values dynamically to the ad tags. Let's say that you maintain registration data for your users, so that when they sign up to use your site they provide you with their age and gender. Your webmaster can set it up so that when a user is signed into your website, information about their age and gender passes dynamically to the ad tags, and then any line items that are targeted to their age or gender will serve to them.

Rules and limitations around key-values in ad tags

Keep the following guidelines in mind when inserting key-values into ad tags:

  • Do not use key-values to pass personally-identifiable information (PII). Under the terms of your contract, you must not pass any information to DoubleClick which DoubleClick could use or recognize as PII.

  • The key must not begin with a number.

  • Each key-value must be preceded by a semicolon (;) separator.

  • The values of key-values cannot contain any of the following special characters: # ' " , * ( ) = + < > [ ] !

  • Unsafe characters must be escaped in ad tags. Learn more about how to escape unsafe, accented, non-English, double-byte, and multi-byte characters.

  • There's no limit to the number of key-values you can include in an ad tag.

  • You can target key-values individually (for example, key=value1;key=value2;key=value3) as in legacy DART for Publishers. You can also place all values within a single key (for example, key=value1,value2,value3); this is preferred for Google Publisher Tags (GPT).

Characters can be unsafe for a number of reasons, some of which are mentioned below:

  • The characters ? : @ have a special purpose in HTTP URLs and will break the ad request if you include them in an ad tag.

  • The characters ; / and & are reserved for special meanings within ad tags and can be used only for those purposes.

  • The characters < and > are used as the delimiters around HTML tags.

  • A quotation mark (") is used to delimit URLs.

  • The character # is used to delimit a URL from a fragment/anchor identifier that might follow it.

  • The character % is used for encodings of other characters.

  • Other characters such as { } | ^ ~ [ ] and \ are unsafe because when they are sent in URLs via the web, gateways and other transport agents sometimes modify such characters.

  • The value of a key-value cannot be empty (for example, cat= or cat=" " or cat=' '). However, where there are instances where the value is intentionally blank, populate the value with null or some other value indicating a blank (for example, cat=null).

  • Key-values are not case sensitive: there is no distinction between words entered in lowercase and uppercase.

Was this article helpful?