Display Ad Server
Serve ads in standard fixed-size ad units
Native Ad Server
Serve native ads on your web page or app
Video Ad Server
Serve MP4 video ads as pre/mid/post-rolls
For Publishers
Maximize revenue for direct deals.
For Advertisers
Optimize campaigns, real-time insights.
Useful for others?
Please share - thanks!

Key/Value Targeting

Written by Roy
2 min read
PDF download
PDF Version
Download instantly

1. String Operators
2. Numerical Operators
3. Boolean Operators
4. AND / OR Operators
5. Do I have to change my ad tags?
6. How does AdGlare retrieve my key/value pairs?
7. How can I test my configuration?
8. Good to know...

Key/Value Targeting is a powerful method to fine-tune delivery of your campaigns. An ad will only be shown if a key matches the value as defined by the campaign's targeting rules. AdGlare's ad serving engines will automatically check if the key is present in a cookie or in the global JavaScript scope.

Contrary to Keyword Targeting you can use numeric, string and boolean operators to set up your expressions. Here's an example of such a configuration in AdGlare.

String Operators

equalscategory=carcarnew carcartoonnew cartoon
does not equalcategory!=carcarnew carcartoonnew cartoon
containscategory=%car%carnew carcartoonnew cartoon
does not containcategory!=%car%carnew carcartoonnew cartoon
begins withcategory=car%carnew carcartoonnew cartoon
does not begin withcategory!=car%carnew carcartoonnew cartoon
ends withcategory=%carcarnew carcartoonnew cartoon
does not end withcategory!=%carcarnew carcartoonnew cartoon
is emptycategory=nullcarnew carcartoonnew cartoon
is not emptycategory!=nullcarnew carcartoonnew cartoon

Numerical Operators

less thanval<1091011369
less than or equalsval<=1091011369
greater thanval>1091011369
greater than or equalsval>=1091011369

Boolean Operators

not truebool!=truetruefalse
not falsebool!=falsetruefalse

AND / OR Operators

Use a , to separate your OR statements. Each new line is considered an AND operator. For example:

x>100, x=null
...can be read as: ((x > 100 || x == null) && upgraded == false)

Do I have to change my ad tags?

For Display Ads you don't have to modify the ad tag whatsoever: it works out of the box. However, for VAST and Native Ads you have to add the key/values to the URL. Keys have to be prepended with kv_. Here's an example:

How does AdGlare retrieve my key/value pairs?

The ad server engines will first check if a cookie is set containing your key. If not, we'll check if your key is found in a global JavaScript variable on the web page by determining:
window[key] !== undefined. If that fails too, the GET parameter will be used as per the example above.

How can I test my configuration?

Keys found as a JavaScript global variable override cookie keys. To test your configuration, you can consider defining those key/value pairs on your web page before loading the ad tag. Alternatively, you can add the key/value pairs to your ad tag as described above.

Good to know...

  • Allowable characters for both keys and values are limited to letters (a-z), digits (0-9), underscores (_) and dashes (-).
  • Operations are case-insensitive.
  • Values should contain no more than 40 characters.
  • If you're targeting user-generated search queries, replace spaces by dashes. For example: q = q.replace(/ /g,'-').replace(/[^0-9a-z-]/gi,'');

About AdGlare

As an established ad server, AdGlare has over 11 years of experience in managing, serving and optimizing ads. Reach out to see how AdGlare can help you achieving your advertising goals. Or sign up for a free 14-day trial to take a quick look inside.

Download this article as PDF?

No time to read the whole article? Download a free PDF version for later (no email required):

PDF download article key-value-targeting-ad-server.pdf


To link to this article, please use: