Aggregation
Generate an aggregation. This is effectively an unbelievably flexible report that allows you to group on any fields you wish, and filter them at your leisure.
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Query Parameters
The entity you want to report on. Events are treated separately from pageviews. Supported values: pageview and event.
pageview
, event
The ID of the site that you want to aggregate pageviews on. Do not include this parameter when entity is set to "event".
Deprecation note: For backward compatability, we still support goal IDs in this field but we don't recommend using this field for that anymore. Use site_id and entity_name parameters instead.
The ID of the site the event belongs to.
The name of the event you want to report on. Example: purchase.
The SUM aggregates you wish to include, separated by a comma.
Supported values for pageview entities: visits, uniques, pageviews, avg_duration and bounce_rate. The difference between "visitors" and "uniques" is that visitors are unique site visits whilst uniques are unique page visits. So a single user can only have one "visit" to your site, but they can view 10 unique pages.
Supported values for event entities: conversions, unique_conversions and value. Note: Value will be returned in cents.
By default, we don't do any kind of date grouping, and we offer "total" aggregations. You can override this but you still have limits such as: When grouping daily, you cannot aggregate over 6 months of data.
none
, hour
, day
, month
, year
The fields you want to group by. Supported values are hostname, pathname, referrer_hostname, referrer_pathname, referrer_source, browser, country_code, region, device_type, operating_system, utm_campaign, utm_content, utm_medium, utm_source, utm_term, keyword, q, ref and s.
You can group by multiple fields using a comma hostname,pathname.
The field you want to sort by. Format is: field:asc|desc. You can use any field that you've asked for in the aggregations and field_grouping options. If using date_grouping, you can also use timestamp:asc or timestamp:desc here, which allows you to sort by date.
"pageviews:desc"
The timezone you want us to use in our queries. We store all data in UTC, and use that by default, but can support any timezone. The timezone you send should be a TZ database name.
Timestamp (e.g. 2022-04-01 15:31:00). This should match the timezone you specified.
Timestamp (e.g. 2022-04-01 15:31:00). This should match the timezone you specified.
A limit on the number of entries to return. For example, if your site had 10,000 unique pathnames, and you had "pathname" in field_grouping, you might get 10,000 rows back by default. You should limit this to prevent timeouts. We have no limits for early access but we'll soon be introducing pagination for this endpoint, and setting a maximum amount of rows that can be returned.
JSON payload. An array of objects. You can add as many filters as you like.
The filtering is hyper flexible and is best illustrated via some JSON payload examples to the right (or below if you're on a mobile).
We support the following operators: is, is not, is like and is not like.
Response
Aggregation data
The response is of type object
.