Aggregate analytics events by field
Breaks the app’s analytics events down by the value of a field, so you can rank them: the busiest pages, the countries your users come from, the most tracked event names.
Every metric must set field, and that field is what the metric groups by. user_id, session_id, event_id, event_name and page_url group by those top-level fields, which is what the default metric does. A metadata. prefix groups by the device information Base44 captures itself: metadata.country, metadata.device_type, and metadata.os. Any other name groups by an event property. Groups come back largest first, capped at max_groups per metric. The range defaults to the last 30 days, and events are kept for 60 days.
Use count for the metric function. Because a metric’s field is both the field it groups by and the field its function reads, the other functions return a value the grouping already implies: count_unique reports 1 for every group, and sum, avg, min, max and the percentiles report the group’s own value.
Each entry in groups carries exactly one metric. When you send several metrics, the list holds one entry per group value per metric, so read the metric name off each entry’s metrics key instead of assuming a single set of groups. group_count counts those entries across all metrics, not the number of distinct group values.
q and a single bucket.Authorizations
Personal API key.
Path Parameters
ID of the app whose analytics to read.
Body
Request for grouped event aggregation.
Name of the event to aggregate. Omit to aggregate every event the app tracks.
"checkout_completed"
Start of the time range. Defaults to 30 days ago.
"2026-07-03T00:00:00Z"
End of the time range. Defaults to now.
"2026-08-02T00:00:00Z"
Maximum number of groups to return per metric, between 1 and 1000. The largest groups are kept.
1 <= x <= 100010
Between 1 and 10 metrics to compute. Each one must set field, which is the field it groups by. Defaults to an event count per event name, named event_count.
1 - 10 elementsResponse
The grouped metrics.
Response for grouped event aggregation.
The event name that was aggregated, or null when the request covered every event.
"checkout_completed"
Number of entries in groups, summed across every metric.
10
Each metric computed over the whole range without grouping, keyed by metric name.
One entry per group value per metric, largest metric value first within each metric.