Advanced targeting is a nice feature that gives you extra control over your ad campaign delivery by checking if the user agent header, referrer URL, or page URL contains a specific sub-string(s). This short article will explain what options this feature has and how to use them.
Campaign configuration
The fields related to advanced targeting are located on the campaign form in the Advanced targeting section.
The following advanced targeting options are available:
- URL substring – URL where ads will be displayed
- Referrer substring – URL from where a visitor has come
- User-agent substring – User-Agent HTTP header from visitors' browser
Generally, the logic behind all these options is the same. The ad server finds occurrences of a substring in an ad request data and makes a decision whether to display an ad or not.
Field format
Substring is a comma-separated string. For example:
apple, orange, mango
Please note that the comma symbol means AND. Therefore, the expression above will be interpreted as "apple AND orange AND mango". So all words must be present to trigger ads display.
If you would like to use negative keywords, you need to place a minus (-) symbol before the keyword. For example:
apple, orange, -mango
As stated before, a comma symbol means AND. So this expression means "apple AND orange AND NOT mango"
Regular expressions
If you need more complex logic (including OR logic), you should use regular expressions.
In this case, a substring has to start from a tilde (~) symbol. Then, it will be treated as a regular expression. We recommend that you double-check your regular expressions and test them here before using them in your campaign targeting.
For example, it can look like this:
~(apple|orange|mango)
In this case, ads will be displayed if either "apple" OR "orange" OR "mango" is present.
Advanced targeting examples
Let's say you have placed the same ad code on several pages, for example:
- http://example.com/blog
- http://example.com/blog/post?id=1
- http://example.com/blog/post?id=2
- http://example.com/blog/post?id=3
- http://example.com/about
- http://example.com/shop
If you would like to display ads on "blog/post" pages only, you should put this expression in the "URL substring" field:
blog/post
When you want to display ads on all pages except "about" and "shop", you should use this expression:
-about, -shop
To display ads on "about" or "shop" pages only, you should use this regular expression:
~(about|shop)
If you wish to display ads on two particular posts, then you should use this regular expression:
~post\?id=(1|3)
To exclude the main page of the domain example.com, but still display ads on all other pages, then you should use this regular expression:
~^(?!.*example.com/$).*$
If you wish to display ads on the main page of the domain example.com only, then you should use this regular expression:
~^.*example.com/$
If you wish to exclude the Safari browser, then you should use this regular expression in the "User agent substring" field:
~^(?!((?!Chrome|Android).)*Safari)
Troubleshooting
At the bottom of the Advanced targeting section, you can see the "Testing tool" link.
This tool allows you to test your substring to see how the system interprets them.
Conclusion
This article should give you a basic understanding of using advanced targeting in advertising campaigns. Though this feature might be very powerful, it's relatively easy to implement and doesn't need any coding experience. Use it wisely, and don't forget to follow the instructions.