Key-Value Targeting in Google Ad Manager: What You Need to Know

Brock Munro
March 18, 2021
March 26, 2024
Key-Value Targeting in Google Ad Manager: What You Need to Know

What is Key-Value Targeting?

google ad manager


Google Ad Manager (GAM) is perhaps the most popular and well-respected Ad Servers in the digital space. And while it generally does a pretty great job of targeting its audience, users can take this a step further by using key-value targeting. Key-value targeting allows publishers to manage their inventory, improve their reporting capability and target their ads to specific users, webpages, and ad slots.

For advertisers, this custom targeting ensures exposure to the right audience, meaning enhanced yield. At the same time, it offers less intrusive ads relevant to both the web page they are visiting and their personal preferences.


Before looking at how publishers can leverage this custom dimension to target ads to specific customers, let's refresh on some ad manager key terms:

Ad Inventory:

This encompasses all the space on a website where a publisher intends to run ads.

Ad Unit:

The ad inventory consists of ad units, representing each section of the website from which ads will run.

Ad Tags:

Ad tags are the code that lies within ad units and sends requests to the ad server.

Line Item:

The ad from the advertiser.


What are Key-values in Google Ad Manager (GAM)?

Key-values in Google Ad Manager (GAM) are customizable parameters that publishers can use to define their ad slots’ targeting criteria. In most cases, publishers will determine these key values by analyzing website visitors’ information, such as their age, location, and other demographics.

According to Google, key-values can be used for a variety of purposes. They can:

  • Identify pages on a website.
  • Specify parts of a page
  • Help target other ad inventory 

In their ad manager account, publishers can take advantage of two unique targeting values to create custom ads for their audience, predefined key values, and free form values.


Pre-defined and Dynamic Values

Via Google Ad Manager, publishers can utilize two different key values; pre-defined key values and free form values.

Pre-defined key values are utilized when the report on values is already known to the publisher. For example, if a publisher knows they want to target an audience from 18 to 35, they can use this as their predefined key. Pre-defined key values are hard-coded into the ad tag, as seen below.

If, however, the values the publisher wants to target are not already determined or can’t be standardized, the publisher will need to utilize what is known as dynamic key values (previously referred to as free form values).

Dynamic key values tend to be used when publishers want to pass values to the ad tags dynamically. For example, if a publisher wants to target their ads based on what search terms users have entered on their site. Dynamic key-values offer the ability to have thousands of inventory key values without defining them ahead of time.

In this way, dynamic key-values are the targeting keys preferred by most publishers, allowing them to create key-value pairs that are unique to the site, targeting thousands of users whilst offering the benefit of little restriction.

Dynamic key values allow for site owners to match values to the targeting keys as broadly or as precisely as they choose, allowing them to create advanced ad units that are custom, using the following types:

  • BEGINS WITH match
  • Include match
  • Begins With and Include Match
  • Exact Match
  • Values with spaces

How to set up key-values and target specific pages in Google Ad Manager

When using key-value targeting in google ad manager, publishers are able to target ads to specific web pages and ad slots within the site. The following three steps will get the job done:

key-values

Step #1 – Add key-values in Google Ad Manager

  1. The first step is to add a new key-value pair to the server. This can be done by going to the Google Ad Manager home page.
  2. From here, click on INVENTORY, then KEY VALUES, then NEW KEY-VALUE.
  3. Enter the key and make sure it matches with the key in the ad tags.
  4. Next, enter a Display Name used by the trafficker in Ad Manager when targeting specific line items.
  5. Now, select the key-value type - dynamic or predefined.
  6. From here, go to Report on Values. Selecting Yes means the keys are reportable and will appear in the Google Ad Manager reports.
  7. Then, enter the values for the key, ensuring they are separated by line breaks. Unlimited keys can be added here.
  8. Finally, save the key values.


From here, the next step is for publishers to add the key values to the ad request.


Step #2: Add Key-values to The Ad Requests


When utilizing GAM key values, there are two types of targeting: page-level targeting and slot level targeting.

To do this, publishers will need to use the setTargeting () function in order to pass multiple keys and values:

Creating ad slot-level targeting requires pasting the following code into the header of the Google publishers Tag (GPT)


 .setTargeting(“interests”, [“food”, “sports”, “movies”]);

.setTargeting(“gender”, “female”)

 .setTargeting(“age”, “18-35”);

Once the key values are passed, the associated targeted line items will be eligible to serve the applicable ad unit.


2. For page-level targeting, custom parameters can be added by pasting the code below into the head of the GPT, following the addition of the network code and targeted ad slots

googletag.pubads().setTargeting(“topic”,”fitness”);


Step #3: Target Key-values Via Line Items


The final step in setting up ads to target specific pages and ad slots in Google Ad Manager involves triggering and serving the line items that match the predefined targeting criteria:

  1. Begin in the Google Ad Manager home page. Click on Delivery, then Order. From here, select the Line Item that you want to target.
  2. Next, scroll down to the Add Targeting section and select Custom Targeting.
  3. Select Key in the drop-down menu, and  enter the corresponding values

Key-value formatting rules

It is important to note that Ad Manager has some predefined formatting specifications when it comes to keys and values:

  • Keys and values are not case-sensitive.
  • Key names cannot be prefixed with a number.
  • All values are treated with the code as strings.
  • Key values and names do not allow the following characters.
  • Spaces are allowed in value names but not in key names.


Key-Value Match types

Match types describe how to target key-value variations. Match types are unique to free-form key values and won’t apply to predefined key-values.

multi-word values

There are several match types as follows:

Exact Match

An exact match is exactly that; users must search for that exact word for it to appear. I.e. if you target fit, fitness and fitter will not match.

‘Begins with’ match 

By using an asterisk (*) at the end of the value, advertisers can match items that begin with a key-value but have additional characters at the end. In this case, fit* would match the values of fitness and fitter as well as longer-form key values such as fitness trainers near me.

‘Include’ match

By adding a tilde (~) at the beginning of a key-value, it will include values that have the entire word in them in any location. For example, fit bit, get fit but not fitness trainers.

‘Begins with’ and ‘includes match’

By using both an asterisk and a tilde on a value: ~fit*, part of the key-value can now appear anywhere, not just at the beginning. Following on from the above example, this would now match fit bit, fitness, and boutique fitness studios.

Values With Spaces

When utilizing key values match types, note that spaces are treated as characters within the value. For example, fit studio* would match fit studio but not fitness studio.


How to know if a specific page is targeted via key-values

There may be instances when publishers need to determine whether the key-value combinations have been successfully uploaded to their site. To do so is quite simple, without the need to sign into the ad manager account. The process is as follows:

  1. Navigate to the desired page and right-click anywhere on the screen.
  2. From here, select View page source and press Ctrl+F of Command+F to find the word targeting.
  3. This will display a code snippet with the key and values displayed. When the values match with the targeting criteria of line items, the eligible line items will, in turn, serve the ad to the respective inventories.


With multiple usages of key values, from slot level targeting to performance analysis via ad manager reporting, once publishers get their heads around the basics, passing key values to ad requests becomes a simple and effective way to target specific customers and gain page slots with maximum yield.

If you’re making more than $2,000 in monthly ad revenue, contact us today to learn more about how Publift can help increase your ad revenue and best optimize the ad space available on your website or app.

Grow with us

Grow your business with a sustainable, long term partnership. If you're making more than $2,000 in monthly ad revenue, contact us today to boost your revenue with our all-in-one solution.
Laptop screen with web page open

Success Stories