Filters
Filter syntax for widget queries
Basic filter object
Attach filter to a widget to narrow matching events.
widget.metric({
id: 'pricing_visitors',
label: 'Pricing Visitors',
event: '$pageview',
aggregation: 'unique_users',
filter: {
$pathname: '/pricing',
},
})Supported operators
| Pattern | Meaning | Example |
|---|---|---|
| Primitive value | Equals | { plan: 'pro' } |
$in | In list | { plan: { $in: ['pro', 'enterprise'] } } |
$gte | Greater than / equal | { amount: { $gte: 100 } } |
$lte | Less than / equal | { amount: { $lte: 500 } } |
Examples
// Campaign traffic only
filter: { $utm_source: 'google' }
// Multi-country
filter: { $geo_country: { $in: ['US', 'CA', 'GB'] } }
// Revenue threshold
filter: { amount: { $gte: 100 } }Funnel step filters
widget.funnel({
id: 'pricing_to_signup',
title: 'Pricing to Signup',
steps: [
{
event: '$pageview',
label: 'Pricing Page',
filter: { $pathname: '/pricing' },
},
{
event: 'signup_completed',
label: 'Signup Complete',
filter: { plan: 'pro' },
},
],
})Current query translation limits
- Current runtime query translation uses the first filter condition only
FilterGroupand nested AND/OR trees are currently ignored by the query layer- Operators outside
eq/in/gte/lteare not translated today