Filter on any property with JPath

Filters read your JSON payloads directly. There's no schema to register and no tagging or flattening step.

What's in a filter

A filter has four parts, all set in the app. The Metrics API, Grafana and Data Endpoints all read from what you define here.

Filter

Which events count. Written in JPath against the payload as you sent it, so new properties work as soon as you send them.

AI assistants already write JPath well. It's based on JSONPath, which is widely documented, so there's no new query language for you or your tools to learn.

@.eventName == 'checkout' && @.cart.total > 0
  • ==
  • !=
  • >
  • <
  • LIKE
  • ILIKE
  • =~ regex
  • in [ ]
  • exists
  • !
  • &&
  • ||
  • .length

Groupings

How to split results. Up to 10 properties, each with an optional alias that's used in legends and API responses.

Ignore any grouping at query time. Keep it, filter it to a few values, or roll it up as if it weren't there. A filter grouped by device and country also gives you totals by device, by country and overall.

Device@.device.typeCountry@.properties.geo.countryCheckouts
iosUS1,204
androidUS877
iosDE312

Interval

How often results are calculated, from 30 seconds to 100 years. Odd sizes work too, like 13 minutes for one in-game day.

Read results back at any wider interval. A 5-minute filter can be charted hourly or daily, so there's no need to keep separate hourly and daily aggregates. That includes unique counts and percentiles, which are merged properly rather than added or averaged.

  1. Filter interval5 minutes
  2. Read as1 hour
  3. Read as1 day
  4. Read as1 week

Aggregations

What to calculate. Up to 10 per filter, each with its own field and calculations: count, sum, min, max, average, percentiles and approximate distinct count.

Each aggregation can have its own sub-filter. Big orders, failed opens or cold starts sit in the same filter as the totals, so you don't need a second filter for each slice.

AggregationFieldCalculations
Revenue@.cart.totalsum, avg, percentiles
Buyers@.userIddistinct count
Big orders@.cart.total > 500nonecount

Writing filters

Address any property, however deeply nested, with dot or bracket notation. Bracket notation handles keys with spaces and special characters.

Next to the filter you get a readable breakdown of how it was parsed, so you can check how && and || are grouped before saving.

Filters reference properties directly, so a new property can be used as soon as you start sending it.

@.eventName == 'appOpen' &&
@.device.type in ['ios','android'] &&
(@.success == false || @.error != NULL)
AND
@.eventName=appOpen
@.device.typeIN'ios', 'android'
OR
@.success=FALSE
@.error!=NULL
Group by
@.app.version
Every 1 minute
AggregationCalculationsField
Cold Boot Timing@.coldBoot == trueAvgPercentile@.durationMs
Failed OpensCountApprox Distinct@.userId

Arrays inside events

Clients often batch things like impressions into one event with an array. You don't have to split those up before sending.

Array flattening treats each item in the array as its own row. Paths starting with @ read the item, and paths starting with $ read the parent event, so per-item fields and shared context like device type can be used together.

Array calculations leave the event whole and aggregate across the array, for example a distinct count of @.impressions[*].item_id.

Working with arrays

Flatten @.impressions · filter @.duration_ms > 500
{ "event_name": "Impressions",
  "device": { "type": "web" },
  "impressions": [
    { "item_id": "abc123", "duration_ms": 4744 },
    { "item_id": "xyz456", "duration_ms": 5500 },
    { "item_id": "zzz555", "duration_ms": 320 }
  ] }
@.item_id$.device.type@.duration_ms
abc123web4,744
xyz456web5,500
zzz555web320

Test against real payloads

Debug Mode runs your filter, groupings, aggregations and timestamp settings against JSON you paste in, and updates as you edit. Paste an array to check several events at once.

It runs in your browser. The JSON you debug isn't sent to our servers.

Debug Mode
{ "event_name": "AppOpen", "ts": 1721491167001,
  "device": { "type": "iOS" }, "duration": 101 }
  • Timestamp @.ts2024-07-20 15:59:27 UTC
  • Filtermatched
  • Grouping @.device.typeiOS
  • Overall Duration @.duration101
  • Cold Open Duration@.cold_open not found

Editing filters

To add a new event, exclude a test environment or add a grouping, edit the filter in the app. No code change or deploy is needed. Results follow the new definition from the time you save, and earlier results aren't recalculated. For larger changes, duplicate the filter so the original's history stays intact.

Previewing results

The Data Preview plots any aggregation over a time range, with each grouping as its own line, so you can confirm a filter matches what you expected before building on it.

More in Real-Time Metrics

Questions

What is a filter?

A filter is the building block for your real-time aggregation. It defines what data matters, how you want to group your aggregations and at what interval. Learn more here

How many aggregations do I get per filter?

You can add up to 10 aggregations per filter. Each aggregation can contain 1-6 calculations, so you don't need to worry about separate aggregations for Counts vs Sums etc.

From $60/month. Every feature on every plan. 14 days free.