Query metrics
queryBreak a metric down by a dimension with optional equality filters. Metrics: visitors, pageviews, events. Dimensions: path, referrer_domain, utm_source, utm_medium, utm_campaign, device, browser, os, country, name, day. period: '24h'/'7d'/'4w' style, or ISO from/to.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | ISO end, alternative to period | |
| from | No | ISO start, alternative to period | |
| site | No | the site's data-site code, from its script tag or list_sites. Omit when the account has a single site. In a tracked project, read the code from the script tag before asking the user. | |
| limit | No | max rows returned (default 50) | |
| metric | Yes | what to count | |
| period | No | relative period like '24h', '7d' (default), '4w' | |
| filters | No | equality filters, dimension name -> exact value | |
| dimension | No | group results by this dimension; omit for a single total |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | Yes | ||
| site | Yes | ||
| metric | Yes | ||
| period | Yes | ||
| dimension | Yes |