Google Ad Manager (previously called DoubleClick for Publishers or DFP) is one of the most popular ad servers in the market and for good reason, its simple user interface coupled with powerful features such as key-value targeting. Key-value targeting enables publishers to organize inventory, target ads to a specific audience, webpage, ad slots, and improve reporting.
Before we go further, let’s refresh on a few basic Google Ad Manager terms:
- Ad inventory: All the space on your website where you intend to run ads.
- Ad unit: The inventory is made up of ad units, which represent sections of your website.
- Ad tags: The code that resides within the ad units and sends ad requests to the ad server.
- Line item: An ad / creative from the advertiser.
What is Key-Value Targeting
Key-value targeting is an inventory feature in Google Ad Manager that allows publishers to define custom targeting criteria, such as search terms or specific pages.
If a line items targets a key-value, the ad server will only serve ads to ad tags on your website that include the specified key-value, provided that other criteria such as specified ad size and frequency capping parameters are also being met.
Predefined & Freeform Values
Google Ad Manager offers two types of key-values based on what you’re trying to target.
Use predefined key-values when you know the possible range of values. For example, if you’re targeting a line item to users based on their age, you can create a key-value and enter the range as the values (“20-30”, “30-40”, “40-50”, …). Now when you create a line item, you will be able to select the ‘Age’ key-value and select the range you want to target. Predefined key values are hard-coded in the ad tag.
In comparison, freeform key-values are used when you need to dynamically pass values to the ad tag. For instance, if you need to target based on the search terms they have used on your website. This way, freeform key-values allow you to have thousands of possible values without defining each one of them ahead of time. Generally speaking, if the key has more than 200 values, use freeform targeting.
Targeting Specific Site Pages and Ad Slots
Using key-value targeting, it is possible to target ads to specific pages and even ad slots on the website. Here’s how you can get it done.
To target pages, create a freeform key-value called
pageID. Provide a unique value such as
pageID=12345 to the ad tags on the pages, now you can target line items to that key-value. In this case, you can think of key-value as a secondary dimension that you can use to create a structure for your ad inventory, without the need to create hundreds of independent ad units to achieve the same result.
To target ad slots, you can create a key-value called
position and assign values based on how you organize your inventory such as
bottom. Once you add the key value in the ad tags, you can start targeting line items to ad slots. This is useful when you want to bundle your above-the-fold inventory and sell it at a premium price, to do this, you can create a key-value
position=top and add this to your ad tags, now you can target desired line items to above-the-fold ad slots.
Key-value Formatting Rules
Keys and values have some predefined formatting specifications:
- Neither keys nor values are case-sensitive.
- Key names cannot be prefixed with a number.
- All values are treated as strings. For example, instead of age >= 18 AND <= 34, age=”18-34″.
- The following characters aren’t allowed in key and value names: ” (double quotes), ‘ (apostrophe), = (equal sign), ! (exclamation point), + (plus sign), # (hash sign), * (asterisk), ~ (tilde), ; (semicolon), ^ (caret), () (parentheses), < > (angle brackets), [ ] (square brackets), , (comma), & (ampersand)
- Spaces aren’t allowed in a key name, but are allowed in value names. For example,
sports car=porscheis not valid, but
car=red porscheis valid.
Key-value Match Types
The “match types” describe how to target variations of key-values. Match types only apply to free-form key-values and are not supported by predefined key-values.
- 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
- “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
traveling, as well as
travel the world, because these terms begin with
travel. It would not match terms such as
where to travelor
- “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,
~travelwould match values like
travel insurance, but not
- “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
traveling penalty, but not
- Values with spaces: When you’re using match types, spaces are treated as characters within the value. For example,
travel deal*would match
travel dealership, but not
Adding Key-values to GPT Tags
You can use the
setTargeting() function with syntax
("key", ["value1", "value2", "value3"]) to pass keys and values to the ad tags. You can use either slot-level or page-level targeting options depending on the use case.
Slot-level targeting: Using this, you can set key-value attributes for individual ad slots on a webpage. Use
.setTargeting to utilize slot-level targeting. It is recommended to use this function when you want to setup granular targeting based on a large number of key values.
Page-level targeting: For broad targeting use cases, for instance targeting ads based on gender or age, page-level targeting is recommended because it requires less code to be added to the tags. Use
googletag.pubads().setTargeting to set page-level targeting.
Learn more about implementation with Google Publisher Tag Samples.
Enabling Custom Reporting with Key-values
Note: This is a beta feature.
Custom reporting allows you to select keys, include them in reports, and use them as a secondary dimension to customize your Ad Manager reports.
STEP 1: Add targeting keys to reporting:
- Click Inventory > Key-values
- Click the name of the key you want to use in reporting
- Click Yes next to “Report on Values”
- Click Save
Once your keys are “reportable”, you can start using them as a custom dimension.
STEP 2: Converting predefined keys into custom dimensions:
- Click Inventory > Key-values
- Click the name of the key you want to include in Ad Manager reports
- Click Yes next to “Make a Dimension”
- Add the targeting values you want to include in Ad Manager reports.
- Click Save
STEP 3: Viewing the report
- Click Reports > Queries > New query
- In the “Dimensions” section, click Custom Dimensions
- Click the name of one or more keys you’ve added as a custom dimension
- Add other report settings, dimensions, and metrics as needed
- Click Run
Enabling reporting using keys as a custom dimension can help you deep-dive in your revenue reporting by measuring and comparing ad performance based on ad positions, search terms, user demographics, and any custom parameter that you have set as a key value.