Conditions
Capabilities to create advanced conditions for your Audience.
Last updated
Capabilities to create advanced conditions for your Audience.
Last updated
Conditions in the Rule Builder refer to the parameters and criteria you define to determine whether a rule should apply to a particular user or event. These conditions help you precisely tailor your Audience targeting, ensuring that your campaigns and messaging reach the right people at the right time.
You can combine several of these conditions in a single ruleset. If you do so, all conditions must be met by the visitor to be eligible for this Audience.
Where conditions are used to set criteria based on parameters such as URL, query, or property parameters. By specifying these conditions, you can target specific user interactions or attributes.
Every where condition consists of a condition key, a matching operator, and a value.
The condition key specifies what absolute or partial URL, query parameter, or referrer to match against.
The full URL as shown in the address bar, including all query parameters.
Example: The URL value of
https://www.example.com/landing-page?utm_campaign=demo&q=query
is that full value.
The segment of the URL following the domain. The path value will always begin beginning with a /
character.
Example: The path of
https://example.com/landing-page?utm_campaign=demo&q=query
is/landing-page
You may select from one of the five standard UTM parameters:
Campaign Name (utm_campaign
)
Campaign Source (utm_source
)
Campaign Medium (utm_medium
)
Campaign Term (utm_term
)
Campaign Content (utm_content
)
Example: The Campaign Name of
https://example.com/landing-page?utm_campaign=demo&q=query
isdemo
.
The value of specific query parameter key.
Example: The
q
query parameter ofhttps://example.com/landing-page?utm_campaign=demo&q=bar
isbar
.
An absolute or partial address of the URL from which the user was directed to your site. Most often, this means a user visited your site when clicking on a hyperlink from another site; the referrer is the page the user was on when they clicked on that hyperlink. Domain, path, and query strings, including UTM parameters, may be present in the referrer value, depending on the referrer policy set by the referrer.
Example: If a user came across a link to
https://example.com/landing-page?utm_campaign=demo&q=query
from a Google search results, the referrer value would behttps://www.google.com
no matter what the full URL of the Google search results page was, due to the referrer policy set by google.com.
A custom key-value pair that has been passed along with a page()
event or track()
call. These are similar in their flexibility to traits sent via identify
calls, but are attached to the page
or track
event itself, rather than to a profile.
Example: Your application could associate the
category
to which a viewed blog post belongs. You could then use this condition key to refine the page view rule rules to only page views with acategory
attribute of specified values.
See our Sending Events documentation for more details on sending properties.
Matching operators let you define how the given value should be matched. There are a number of different matching operators that you can choose from like equals
, contains
, comparison operators, and more.
For precise matching, you may use matches
operator and supply a regular expression. When using matches
, supply a pattern with or without preceding and trailing /
characters. However, /
characters are required if you intend to supply a flags as part of your expression, e.g., /pattern/flags
.
This represents the value you want to match the key against. Ensure that your value makes sense in the context of the condition and users you want to reach. For example, consider if exactly matching a whole URL is necessary, or if you can be more flexible to match a fragment (contains
) of a URL.
You can use a value of *
as a wildcard matcher combined with an equals
matching operator (or any other). This can be useful to construct an audience defining all visitors.
When conditions allow you to set time-bound criteria for your rules. You can specify conditions such as "within" to define a specific time frame during which the rule should be active. This feature is particularly useful when you want to target users based on recent activity or events.
There are two different types of When Conditions, "within" and "in previous sessions".
When this condition is set, the user will match the rule only if they have met the rule's other conditions within the specified time frame. If the criteria of the rule has not re-met within that time frame, the user will be excluded from that Audience.
When selecting this option, the user will match the rule if this condition has been met in any of the previous sessions.
Example: If you would like to personalize any contents on the website only after the user has left the current session, you can use a "In Previous Sessions" rule to account for that.