Define and target key-values

Define key-values

  1. Sign in to DoubleClick for Publishers.
  2. Click Inventory and then Key-values and then New key.
  3. Enter the name that will be used in the ad tag for your targeting key in the Name box.
  4. Enter the name that your traffickers will see when they're targeting key-values in the Display name box.

    You may want a different display name if you're going to encode your key-values. You might use encoded key-values in your ad tag if you don't want visitors to worry about the information that's passed in the tag. For example, if you're targeting females, you would use the encoded key-value g=f in the ad tag. To make it easier for traffickers to find this key-value in DFP, you can assign the display name 'gender=female' to the key-value.

  5. Select whether you will enter targeting values when creating line items or predefine your key-values.
  6. Click Add values, enter the targeting values, separated by line breaks, and click Apply.  These values will be used in the ad tag. You can enter targeting values for both predefined and free-form keys. You may want to add values for free-form keys to suggest values to your traffickers while still allowing them to enter their own.
  7. To enter names that your traffickers will see when they're selecting targeting values, click the Display name column next to the targeting value. Enter the display name in the box that displays and click Apply.
  8. Click Save.
You can quickly edit display names directly under Inventory and then Key-values. Click a display name, make your changes, and click Save.
Format key names and values
  • Casing: Neither keys nor values are case-sensitive.
  • Maximum characters and key-values: Learn about system maximums for characters, keys, and values.
  • Multiple values per page: You can pass multiple values per page.
  • Data type of values: Values are not data-specific; all values are treated as strings. For example, instead of using age >= 18 AND <34, try 18-34.
  • Numeric prefix: Key names cannot be prefixed with a number.
  • Key names and key values invalid characters: You can't use the following characters when you create key names and key values:

    " (double quotes)
    ' (apostrophe)
    = (equal sign)
    ! (exclamation point)
    + (plus sign)
    # (pound sign)
    * (asterisk)
    ~ (tilde)
    ; (semicolon)
    ^ (caret)
    () (parentheses)
    < > (angle brackets)
    [ ] (square brackets)
    , (comma)
    & (ampersand)
    Spaces: You can't use spaces in the key of a targeting criterion. For example, sports car=porsche is not valid. You can, however, use spaces in the value. For example, car=red porsche is valid.

  • Key-value invalid characters for audience segments: A custom key within an audience segment only supports alphanumeric characters and underscore (_). Custom keys in audience segments must start with a non-numeric character. For example, abc123 is valid; 123abc is not. Learn more about audience segments
      Not available in DFP Small Business.
  • Key-value invalid characters for macros: Keys used in the pattern match macro and the video metadata macro only support alphanumeric characters and underscore (_).

Target key-values

After you add key-values to Google Publisher Tags (GPT), target key-values with line items the same way you target all other criteria. The "match types" and advanced expressions below describe how to target variations of key-values. Learn more about line item targeting

Match types only apply to free-form key-values and are not supported by predefined key-values.
Match types

You can use different match types to more broadly target line items to search terms and other dynamic criteria.

  • Exact match

    If you don't add any special modifiers to a targeted value, the user search must match it exactly. For example, if you target travel, travelers and travels don't match.

  • "Begins with" match

    Use an asterisk (*) at the end of a value to match items that begin with the value but have additional characters at the end. For example, travel* would match values like traveler and traveling, as well as travel the world, because these terms begin with travel. It would not match terms such as where to travel or fasttravel.

  • "Include" match

    Use a tilde (~) at the beginning of a value to include values that have the entire word in them, in any location. For example, ~travel would match values like adventure travel and travel insurance, but not travelers or travelers insurance.

  • "Begins with" and "include" match

    Now we're getting fancy. You can use both a tilde and an asterisk on a value: ~travel*. The "begins with" part of the value can now appear anywhere in the value, not just at the beginning. Our example would match travelers, luxury travelers, travel insurance, traveling penalty, but not re-travel.

  • Values with spaces

    When you're using match types, spaces are treated as characters within the value. For example, travel deal* would match travel deals and travel dealership, but not traveling deal.

The following tables give more examples of different match types. For each value on the left, you can see whether a series of search terms are considered matches. Terms that don't match are crossed out.

Single-word values

Match type Value Does the search term match?
Exact match car car car parts cartoon used car Madagascar
Begins with car* car car parts cartoon used car Madagascar
Include ~car car car parts cartoon used car Madagascar
Begins/include ~car* car car parts cartoon used car Madagascar

The following table gives examples of different match types for multi-word values.

Multi-word values

Match type Value Does the search term match?
Exact match new car new car new car buy new car new car smell new cartoon
Begins with new car* new car new car buy new car new car smell new cartoon
Include ~new car new car new car buy new car new car smell new cartoon
Begins/include ~new car* new car new car buy new car new car smell new cartoon

These match types can also be applied to key-values that aren't search terms.

In addition to using these match types for search terms and key-values that are dynamically passed to the ad tag (like demographic information about a user), you can use them in key-values that are hard-coded in the ad tag (like information about the content of the page).

For example, let's say you have a car website and you've made key-values for the make and model of cars that you feature on the site. You may have a key-value for car=hondacivic that is hard-coded in the ad tags on the pages of your site that discuss the Honda Civic. You may also have key-values for car=hondaaccord and car=hondainsight. If you want to target all the pages of your site that discuss Hondas, you could target a line item to car=honda* and that line item would show to any key-value that has a value that begins with the word honda.

The above example is of a "begins with" match, but you can also use other match types to target key-values that aren't search terms.

Advanced expressions

For advanced users who want to create complex targeting expressions, you can click advanced expression and enter or paste a regular expression containing your key-values. The key names must match key names that have been created in DFP, and the values must be either defined values or free-form values that have already been passed to the ad server at least once. When you're done, click Process expression.

Use De Morgan's Laws to create various equivalents of advanced expressions.

To create an expression, you can use the following operators:

= (equals)
!= (is not)
( ) (parentheses to group items)
, (or)
and (and)
" " (use quotation marks around spaces)

Example expressions: 

  • (age=13-20, age=40-50) AND (income=10k, income=20k) AND status!=member AND hobby="rock climbing"
  • NOT (playing AND eating) is equivalent to (NOT playing) OR (NOT eating).
  • NOT (soccer OR basketball) is equivalent to (NOT soccer) AND (NOT basketball).

To target audience segments when targeting inventory, click Key-values and audience, then select Audience segment from the drop-down. Enter a value or start typing and click a segment name as it appears in the list.

Deactivate key-values

To delete key-values, enable the checkbox next to the key name and click Delete. However, it may make more sense to think of this action as deactivating the key, rather than deleting it. Learn about deactivating key-values.

Was this article helpful?
How can we improve it?