Audience Builder
The Audience Builder provides a visual interface for defining targeting rules without writing code. Combine conditions using AND/OR logic to create precise audience segments.
Rule Structure
Each rule consists of three parts:
- Field -- The user property to evaluate (e.g.,
role,device.type,traits.plan) - Operator -- The comparison to perform (e.g.,
eq,contains,gt) - Value -- The value to compare against (e.g.,
"admin","mobile",100)
Supported Fields
| Field | Description | Example Value |
|---|---|---|
userId | The user's external identifier | "user-42" |
traits.* | Custom user properties (dot notation) | traits.plan, traits.department |
role | The user's role in your application | "admin", "viewer" |
device.type | Device category | "desktop", "mobile", "tablet" |
device.os | Operating system | "Windows", "macOS", "iOS" |
device.browser | Browser name | "Chrome", "Firefox", "Safari" |
browser | Browser name (shorthand) | "Chrome" |
location | Location properties (as key-value map) | location.country, location.region |
Comparison Operators
The targeting engine supports 15 comparison operators:
| Operator | Description | Operator | Description |
|---|---|---|---|
eq | Equals | neq | Not equals |
gt | Greater than (numeric) | lt | Less than (numeric) |
gte | Greater than or equal | lte | Less than or equal |
contains | String includes / array includes | not_contains | String excludes / array excludes |
in | Value in list | not_in | Value not in list |
exists | Field is present, not null | not_exists | Field is absent or null |
regex | Matches regular expression | starts_with | String starts with prefix |
ends_with | String ends with suffix |
String operators (contains, not_contains) are case-insensitive. Numeric operators (gt, lt, gte, lte) require both values to be numbers.
Combining Rules with AND/OR
Rules are organized into groups joined by a logical operator:
- AND -- All rules in the group must match.
- OR -- At least one rule must match.
Groups can be nested to express complex logic:
AND
device.type eq "desktop"
OR
role eq "admin"
traits.plan eq "enterprise"
This matches desktop users who are either admins or on the enterprise plan. An empty rule group evaluates to true by default.
Creating an Audience
- Go to Audiences and click Create Audience.
- Enter a name and optional description.
- Add rules using the field, operator, and value dropdowns.
- Switch between AND/OR logic and add nested groups as needed.
- Click Save to create the audience.
After saving, the audience is immediately available for targeting flows, tooltips, and other content.