Using keyword targeting

Keyword targeting allows you to display ads only when specific keywords or key/value pairs are passed in the ad request. You can build complex phrases with multiple keywords and connect them with operators. Insertions and creatives will only be displayed if the ad request passes keywords which match with the defined keyword targeting phrase.

Use cases

Here are a few use cases for keyword targeting:

  • you work with a behavioral targeting vendor, which creates profiles for users (demographic information, product affinity etc.); with keyword targeting you can target to these profiles (audience segments)
  • you have a website, where users can search for products and prices; with keyword targeting, you can to target ads to product categories and price ranges
  • on your website, users can register to become members; with keyword targeting you can target ads to members or non-members of your website

About simple keywords and key value pairs

Throughout this guide, you will find the terms "keywords" and "key value pairs". Smart AdServer's keyword targeting supports both simple keywords (e. g. "male" or "green") and key value pairs (e. g. gender=male or color=green).

As a general rule, we recommend using key value pairs as this is more convenient to identify and manage keywords. Also, key value pairs are future proof: some time later, you may introduce new keys with values you have used previously with another key. For instance, you may target an insertion to "residence=paris" to address users who live in Paris. Later, you may introduce the new key "destination=" (for users travelling to Paris) and target insertions to "destination=paris". In such a scenario, using simple keywords may get you into trouble with keeping things apart.

Passing keywords

This section is mainly for those who integrate Smart AdServer's ad tags.

Smart AdServer's Keyword Targeting supports two entry points: you can pass keywords

  • attached to the ad request; for this, read this guide
  • stored in a cookie and passed along with the ad request (read here for cookie targeting)

The setup of the actual targeting criteria is the same, no matter which entry point is used: you define the criteria on the Targeting tab in insertions.

Passing keywords with "target" parameter

To pass keywords in ad tags, you need to define them in the target parameter. Here is an example of the Smart AdServer library and an ad tag passing the three simple keywords "green;george;mercedes".

<script src='' type="text/javascript"></script>
<script type="text/javascript">
    sas.setup({ domain: ''});
<script type="text/javascript">"std", {
        siteId:     72995,  //
        pageId:     547913, // Page : mywebsite/mypage (PageID=547913)
        formatId:   32179,  // Format : myformat
        target:     'green;george;mercedes' // Targeting

The library will encode the keywords/key value pairs and insert them after the tgt= parameter in the ad request URL. For the example above, the ad request URL will look as follows:

General rules

Here are the rules for filling the target parameter:

  • Always separate keywords or key value pairs with a semicolon (;). When passing a single simple keyword or a single key value pair, add a semicolon as well. Example: 'green;'
  • Place the keywords within the single quotes (e. g. target: 'green;george;mercedes'). Do not remove the single quotes.

Passing string values and numeric values

You can pass key value pairs with string values and/or with numeric values. Here are the rules:

  • Separate the numeric key value pairs from string key value pairs using a semicolon (;) and a pipe character (|). Example: 'color=green;|price=2000'
  • Write the numeric key value pairs after (to the right side of) the separators; example: 'color=green;name=george;|price=2000'
  • Use the pipe character (|) only once per ad request

Passing keywords in ad request URL

In some cases, you may not want to use the target parameter. If you wish to attach the keywords manually, please URL-encode them and pass them as values to the tgt= parameter.

Example of an ad request which passes the key value pairs: color=green;name=george;brand=mercedes

Examples how to pass keywords

The following table illustrates how to fill the target parameter in order to pass keywords. The Example column shows what you need to place within the single quotes of the target parameter:

Items to be passed Example
Passing a key value pair with a string value color=green;
Passing multiple string values for the same key ("color") color=green;color=red
Passing string values for different keys ("color", "name") color=green;name=george
Passing string key value pairs and numeric key value pairs color=green;name=george;|price=2000;age=21
Passing a simple keyword green;
Passing multiple simple keywords green;george;mercedes;
Passing simple keywords and key value pairs with numeric values green;george;|price=2000;age=21

Keyword targeting on insertion level

Keyword targeting on insertion level

Go to your insertion and switch to the Targeting tab. Scroll down to the Keywords / Keyword groups section and expand it.

String values

In the context of keyword targeting, string values means that you can express that a certain string (chain of characters) must be present (or absent) in the ad request. You can use operators to express the conditions.

Under Keywords, click Add a line (1)

To target your insertion to a simple keyword, enter the keyword in the "Values" field (2).

Click the "Plus" icon (3) to display an additional Value field and enter additional keywords. These will be "or"-connected: if one of the keywords is passed in the ad request, the insertion will be selected and delivered.

To add "and"-connected keywords, click Add a line (2) and enter the keywords as you did in the first line.

To express exclusion of a keyword (negative targeting, i. e. operator "and not"), select the 'No' checkbox (4) in the appropriate line.

To target to key value pairs, enter the key in the Key field (5) and the value in the Value field (2). You can use the same operators and workflows as for simple keywords.

When working with large amounts of keywords, it may be more convenient to use the text editor. To open it, click Switch edit modes and enter your keywords using the following syntax:

  • comma (,) to express "or"; (Example: gender=male,color=green)
  • semicolon to express "and" (Example: gender=male;color=green)
  • semicolon and "Not" to express negative targeting (Example: name=george,name=john;Not color=green,color=yellow)

You can also jump between the text editor and the text field mode. The criteria will be transformed into the appropriate syntax automatically. However, before you switch between the modes, always save your changes using the Save button at the bottom of the page.

Numeric values

You can also target to key value pairs with numeric values (either to an exact numeric value or to numeric values within a range). For instance, you could pass a price value and target your insertions to all the prices between EUR 10 and EUR 50.

To define the criteria, use the section Range of values (8)

  • Use the operator "=" (9) to target to an exact numeric value
  • Use the operators "" and "≤" to target to a range

Keep in mind: only integer values can be used! You cannot target to values with decimal separators. For instance, if you want to pass and target to prices (in EUR), you have to pass EUR-Cent values (1125 EUR-Cents instead of EUR 11.25). To target to EUR values between 10 EUR and 20 EUR, you would define:  price ≥ 1000 ≤ 2000.

Keyword targeting on creative level

Keyword targeting on creative level

While targeting for insertions will apply to all the creatives of the insertion, targeting for creatives allows for criteria applied to specific creatives.

Go to the Creatives tab of your insertion.

Upload and configure your creatives - you need a minimum of 2 creatives in the insertion.

Under Rotation mode, select Targeting per keyword (1).

To assign keywords to creatives using Keyword groups (read more below), select the appropriate group (2).

Edit each creative and define the appropriate value next to Targeting per keyword (3) and save the creative.

When using keyword groups, you can only assign one value per creative. To assign multiple values to a creative, use the manual mode instead: Select None for the keyword group, edit each creative and add the keywords manually.

Make sure you have at least one creative without any keyword targeting. This non-targeted creative will be used as a fallback (in case none of the creatives matches the keywords passed in the ad call).

If you have no fallback creative, please target the insertion to the same keywords, to which you targeted your creatives.

You have one creative targeted to "green" and another keyword targeted to "red". There is no non-targeted creative.
In this case, you need to go to the Targeting tab of your insertion and target it to "green OR red".

Keyword targeting on creative level only works when passing the keyword as a parameter of the ad call (keywords stored in cookies cannot be used).

Keyword groups

Keyword groups

You may have certain keyword targeting criteria you use on a regular basis. To define keyword targeting criteria once and reuse them, you can make use of Keyword groups. With keyword groups, you can also pass encrypted names in ad requests, but display the plain names in the user interface. For instance, you could pass "gen=m" in the ad request, but display this as "gender=male" in the user interface. This makes the workflow easier for Campaign managers. Keyword groups only support key value pairs: you cannot define (or target to) a key with no values.

To set up keyword groups, go to Administration > Groups of keyword

Click Add a group (1) and define a Name and a Delivery name. The Name is the plain name of the key. This name will be displayed in the user interface (in insertions or creatives). The Delivery name is the name of the key as it is passed in the ad request.

To add values for the key, select the Keyword group, and click Add an item (2). Enter a Name and a Delivery name and click Save. The Name is the plain name of the value. This name will be displayed in the user interface (in insertions or creatives). The Delivery name is the name of the value as it is passed in the ad request.

To target insertions with keyword groups, go to the Targeting tab or the Creatives tab of insertions. Select the Keyword group (i. e. the key) and select the values you want to target. Again, keep in mind that you will see the plain names here, not the Delivery names.

Keep in mind: the values for the same key are "or"-connected. The keys are "and"-connected with each other.

Targeting templates

Targeting templates

You can use targeting templates to define sets of keyword targeting criteria used on a regular basis.

Click on Campaigns (1) and switch to the Template groups tab (2). Alternatively, when you are on the Targeting tab in an insertion, click Create a template.

Click Create a new group template (3). This leads you to the Administration menu. Define a Name and a Description (optional) and select the Type: Targeting. Click Save.

Navigate back to Campaigns > Template groups and click on the Targeting template group (4) you just created.

Click Create and select Web template (desktop/mobile/responsive websites) or Mobile template (iOS/Android apps with Smart AdServer's SDK).

Define a name, define the keyword targeting criteria and save the template.

To use the template in insertions, select it on the Targeting Tab (at the top of the page) and click Load.


It is possible to combine keywords with string values, keyword groups and keywords with numeric values in a single insertion.

However, keep in mind that they are "and-"connected. For instance, if you target an insertion to the string key value pair "name=george" and to the numeric key value pair "price=2000", the insertion will only deliver its ad if both are passed in the ad request.


Insertion priorities

Keep in mind, that the keyword targeting restricts delivery, but does not increase the priority of the insertion.

Here is what happens when an ad request (carrying keywords) reaches the ad server:

  • all the insertions with non-matching keyword targeting criteria will be ignored
  • the remaining insertions are either insertions without any keyword targeting or with matching keyword targeting criteria
  • the delivery engine selects the insertion depending on their individual priorities

To make sure that keyword targeted insertions are preferred in the ad delivery, you have to define a higher priority for them: for instance Exclusive 2 for the keyword targeted insertion and Exclusive 3 for the insertion without keyword targeting.

Limitations, restrictions and workarounds

"And"-connections for values in keyword groups

When using keyword groups, the values for a key are "or"-connected. Example: you have the key "color" with the 3 possible values "red", "blue" and "green". When you select "red" and "blue" in an insertion, then "red" and "blue" are "or"-connected with each other.

To express an "and"-connection between the keys, you can Keyword targeting (manual mode) instead of Keyword groups.

Another option (which can be laborious) is to copy the insertions with all their settings (same creative, same placement, same start and end date etc.). For the example above, this would mean creating 3 insertion copies with each copy targeted to only one of the three key value pairs. After copying, you can assign a shared impression volume using the feature "group volume".

"Or"-connections for "and"-connected keywords

It is not possible to connect "and"-connected keywords with the "or" operator. For instance, you cannot express the phrase [(color=green and color=red) or (name=george and name=alice)].

As a workaround, you can copy the insertions and target insertion A to "color=green and color=red" and insertion B to "name=george and name=alice". After copying, you can assign a shared impression volume using the feature "group volume".

Limitation for criteria combinations

You can define a maximum of 200 criteria combinations on the targeting tab of an insertion. This applies to both keyword targeting and the other targeting types (e. g. Browser targeting). Keep in mind that "or"-connections between criteria may significantly increase the amount of criteria combinations. Look at the table below for a better understanding of criteria combinations.

Please consider these limitations when using keyword targeting alone or in combination with other targeting criteria. If you expect issues with these limitations only in isolated cases, you can fall back on a workaround: copy the insertions and define only a subset of the criteria in each insertion. You can assign a shared impression volume to all the insertion copies using the feature "group volume".

Selected criteria Example # Com-
1 Browser targeting criterion and 1 key value pair Firefox and name=george 1 Firefox + name=george
2 Browser targeting criteria and 1 keyword Firefox or Chrome and car 2 Firefox + car
Chrome + car
2 "or"-connected key value pairs and 2 cities (Quova Geotargeting) name=george or name=alice and Paris or London 4 name=george + Paris
name=george + London
name=alice + Paris
name=alice + London

groupes de mot-clé mots-clés key word key words

Was this article helpful?
1 out of 2 found this helpful
Powered by Zendesk