Filters let you isolate and analyze subsets of your data. You can use filters on any query type, including the Funnel Report, Cohort Report, People Search, and A/B Test Report.
They can be used to isolate data by specific events or properties. Furthermore, you can use filters to isolate data where a person did a certain event with a specific property or just property. Filters become even more powerful when you nest or chain them together using logical operators.
Filter object properties
Property Name | Required? | Description |
---|---|---|
| Yes | Filter type:
|
| No | Set to |
| No | Set to |
| No | Set to |
| Yes, if the | The index of the event. |
| Yes, if one of the following:
| The index of the property. |
| Optional if the filter | Set to |
| Optional if the filter | Set to |
| Yes, if both of following are true:
| The value used to calculate the frequency occurrence. For example, at least |
| Optional if one of the following:
| The comparison mode to use when filtering by properties, or events with properties. Use comparison modes to filter for specific property values. See Property Filter Comparison Modes. |
| Required if | The string to use when comparing property values. |
| Required when the | The minimum value when comparing a property that should be within a range. |
| Required when the | The maximum value when comparing a property that should be within a range. |
| No | A Date Range object. |
Property Filter Comparison Modes
Property Value Type | Acceptable Comparison Modes |
---|---|
Text values | "contains" , "begins_with" , "ends_with" |
Numeric values | "greater_than" , "less_than" , "greater_than_or_equal_to" , "less_than_or_equal_to" , "in_range" |
Any values | "any_value" , "empty" , "equals" |
Logical Operators
More complex queries will require that multiple filters be chained together as is the case for constructing:
- All who did/have any of these events/properties (
type: "or"
) - All who did/have all of these events/properties (
type: "and"
) - All who did/have all of these events/properties in order (
type: "then"
)
Here's how the filter object looks when using logical operators:
Property Name | Required? | Description |
---|---|---|
| Yes | One of the following:
|
| Yes | An array of Filters. This can also include nested logical operators, see Nesting Filters . |
| No | A Date Range object. |
Nesting Logical Operators
Filters can be nested to abitrary depths by placing Logical Operators within Logical Operators. To visualize, imagine a tree, where Logical Operators can be either AND/OR/THEN and filters can be Event, Property, or EventWithProperty:
// Expression Tree
AND
/ \
OR OR
/ \ / \
Event Event AND Property
/ \
Property EventWithProperty