API
Metric endpoints
metric is the endpoint behind most tables in the dashboard. You name a dimension, and it returns the values for that dimension with their counts. Scope: analytics:read. Public sites and private links can call it.
Last updated . This guide belongs to API access and data export.
GET /sites/:siteId/metric
| Parameter | Required | Meaning |
|---|---|---|
parameter | Yes | The dimension to group by |
limit | No | Rows per page. Default 100, maximum 10,000 |
page | No | Default 1 |
It also takes the shared time parameters, filters and segment_id.
Which dimensions can you use?
| Group | Values for parameter |
|---|---|
| Pages | pathname, page_title, querystring, entry_page, exit_page, hostname |
| Sources | referrer, channel, utm_source, utm_medium, utm_campaign, utm_term, utm_content |
| Location | country, region, city, timezone, language |
| Device | browser, browser_version, operating_system, operating_system_version, device_type, dimensions |
| Other | event_name, tag |
| URL parameters | url_param:<name>, for any query parameter your site receives |
The same names work as parameter inside filters, apart from url_param:<name>.
What does the response look like?
{ "data": { "data": [ { "value": "/pricing", "hostname": "example.com", "count": 412, "percentage": 22.35, "pageviews": 530, "pageviews_percentage": 12.86, "time_on_page_seconds": 41.7, "bounce_rate": 38.11 } ], "totalCount": 87 } }
Rows are sorted by count, highest first. count is sessions, apart from event_name, where it is events.
Page dimensions add pageviews, time_on_page_seconds and bounce_rate. totalCount is the number of rows across all pages.
GET /sites/:siteId/page-titles
Returns page titles with their path. limit defaults to 10. Send page to get totalCount as well.