Condition Reference
Complete reference for every condition type, their required fields, and example JSON.
event_count#
Matches users based on how many times they have fired a given event type.
| Field | Type | Required | Description |
|---|---|---|---|
| event_type | string | Yes | The event type to count (e.g., order_placed) |
| operator | string | Yes | Comparison: eq, neq, gt, gte, lt, lte |
| value | number | Yes | The threshold count |
| window_days | number | No | If set, only counts events in the last N days |
recency#
Matches users based on how many days have passed since they last fired an event. A larger value means the user hasn't been seen recently.
| Field | Type | Required | Description |
|---|---|---|---|
| event_type | string | Yes | The event type to check recency for |
| operator | string | Yes | Comparison: gt (churned), lt (active), eq |
| window_days | number | Yes | Days-since-last threshold |
monetary#
Aggregates a numeric property across all events of a given type and compares the result to a threshold. Useful for lifetime value, total spend, average order value.
| Field | Type | Required | Description |
|---|---|---|---|
| event_type | string | Yes | The event type to aggregate |
| property | string | Yes | Payload property name to aggregate (e.g., total) |
| metric | string | Yes | Aggregation: sum, avg, or max |
| operator | string | Yes | Comparison: eq, neq, gt, gte, lt, lte |
| value | number | Yes | The threshold value |
event_property#
Checks the latest value of a specific payload property on the most-recent occurrence of an event type.
| Field | Type | Required | Description |
|---|---|---|---|
| event_type | string | Yes | Event type to inspect |
| property | string | Yes | Payload property name |
| operator | string | Yes | Any operator appropriate for the value type |
| value | any | Yes | The value to compare against |
user_property#
Checks a trait from the user's context_identified event payload. Properties are keyed by name and hold the value from the most-recent identify call.
| Field | Type | Required | Description |
|---|---|---|---|
| property | string | Yes | Trait name (e.g., plan, country) |
| operator | string | Yes | Any operator appropriate for the value type |
| value | any | Yes | The value to compare against |
event_sequence#
Matches users who fired a specific ordered sequence of events within a time window. Useful for funnel-based audiences (viewed pricing → started trial → cancelled).
| Field | Type | Required | Description |
|---|---|---|---|
| events | array | Yes | Ordered list of objects, each with event_type |
| window_days | number | Yes | Sequence must occur within this many days |
| strict | boolean | No | If true, no other events may occur between steps |
segment_membership#
Checks whether a user is currently a member of another segment. Enables segment composition — for example, “in the VIP segment but not in the recent churners segment.”
| Field | Type | Required | Description |
|---|---|---|---|
| segment_id | number | Yes | The ID of the segment to check membership in |
| operator | string | Yes | in or not_in |
Operator Reference#
| Operator | Meaning | Numeric | String | Boolean | List |
|---|---|---|---|---|---|
| eq | equals | ✓ | ✓ | ✓ | |
| neq | not equals | ✓ | ✓ | ✓ | |
| gt | greater than | ✓ | |||
| gte | greater than or equal | ✓ | |||
| lt | less than | ✓ | |||
| lte | less than or equal | ✓ | |||
| in | value is in list | ✓ | ✓ | ||
| not_in | value is not in list | ✓ | ✓ | ||
| contains | string contains substring | ✓ | |||
| does_not_contain | string does not contain substring | ✓ | |||
| starts_with | string starts with prefix | ✓ | |||
| ends_with | string ends with suffix | ✓ | |||
| matches_regex | matches regex pattern | ✓ | |||
| between | value within inclusive range | ✓ | |||
| not_between | value outside range | ✓ | |||
| is_set | property exists and is not null | ✓ | ✓ | ✓ | ✓ |
| is_not_set | property is null or missing | ✓ | ✓ | ✓ | ✓ |
| is_true | boolean is true | ✓ | |||
| is_false | boolean is false | ✓ |
Full Segment Example#
A complete segment definition combining multiple conditions with AND logic:
This segment matches users who: spent at least $500 total, placed 3+ orders, visited in the last 60 days, and are not on the free plan.