Keyword Logic
Overview
Warning
Keyword logical operators only apply to flight-level keywords, at ad-level the default logic uses an OR operator between keywords.
When you write keyword targeting rules in the Kevel UI, or via the API, there is specific business logic you must follow, which is described below.
If you use the Kevel API, you will want to include the string under the 'keyword' field when using the Create Flights endpoint, or the ActiveKeywords
field using the Create Ads endpoint.
If you use the Kevel UI, you will add strings to the Keyword Targeting section.
Note
Operators only work at flight-level keyword targeting (not ad-level).
Operators
For keyword targeting, Kevel uses 'AND', 'OR', and 'NOT' operators. Formatting for UI and API varies slightly, so please refer to the table below for the differences. between these operators
Operator | UI | API |
---|---|---|
AND | Separate by commas | Separate by commas |
OR | Separate lines | Separate with \n . No spaces |
NOT | Add ! to start of word | Add ! to start of word |
Examples
The section below provides several examples of keyword logic and targeting using different keywords.
Example 1
In this example, let's use the keywords dodge' and
truck` in different requests to show how targeting will work, depending on the syntax of the request.
If you use the keyword dodge
in your request, then Kevel will perform targeting of all ads including the term `dodge.'
UI & API |
---|
dodge |
If you place an exclamation point !
before the keyword dodge
in your request, then Kevel will target anything that does not include the keyword dodge.
UI & API |
---|
!dodge |
If, however, you use dodge
and truck
keywords in your request separated by a comma, then both dodge
AND truck
will be targeted. Note that you must include both keywords in your request.
UI & API |
---|
dodge, truck |
If you would like to target dodge
OR truck
in your request, add both keywords in the request if using the Kevel UI. If you would prefer to use the Kevel API, use `dodge\ntruck.'
UI | API |
---|---|
dodge truck | dodge\ntruck |
Finally, if you would like to target dodge,
but not truck,
, use a comma to separate the two terms and an exclamation point before `truck'.
UI & API |
---|
dodge, !truck |
Warning
In the examples above, this will be considered as ((dodge) AND NOT (truck)). However, a ! at the start of the line will apply to the whole line.
In other words,
!a
,b
,c
will be considered as (NOT (a) AND NOT (b) AND NOT (c)).However,
a
,!b
,c
will be considered as ((a) AND NOT (b) AND (c)).
If you would like to target dodge
and truck
, or dodge
and ram
, review the table below for the proper syntax.
UI | API |
---|---|
dodge, truck dodge, ram | dodge,truck\ndodge,ram |
Note
Using negated keywords in an
OR
list will negate any queries with that keyword. For example:
fox, bunny
buffalo, cheetah
!sloth
Would be parsed as:
((fox AND bunny) OR (buffalo AND cheetah)) AND (NOT sloth)
This means that an ad will be served whenever
fox
andbunny
are used together in the request, or whenbuffalo
andcheetah
are used together, but not whensloth
is also passed in.
Updated 3 months ago