Analytics
What a website’s visitors did, as metrics rather than as events: requests, page views, unique visitors and who is on the site right now. :query reads one metric over a period in the site’s own time zone, as a total and as a series; anything counted with a probabilistic sketch says so with approximate. Collection happens on the site’s own domain and is not part of this API.
List analytics_metrics
What this website's analytics can count, one row per metric, with what each number means and which periods and intervals it accepts. Nothing here is stored or writable: it is the platform's catalogue, and a metric your client does not recognise is one it should skip rather than fail on. The numbers themselves come from :query on one of these rows.
path Parameters
website_idId of the parent website.
query Parameters
page_sizeRows per page. Over the maximum is clamped, not rejected.
page_tokenOpaque token from a previous next_page_token. A token minted under a different order_by/filter is rejected.
skipRows to skip before the page (AIP-158). skip + page_size is capped at 10000; beyond that is OUT_OF_RANGE.
order_byComma-separated field [asc|desc], at most 3 keys. Default: create_time desc. Sortable: none — this collection serves its documented order only.
filterAIP-160 subset (§8). Filterable: none. A field outside the list is INVALID_ARGUMENT.
List analytics_metrics › Responses
One page of analytics_metrics.
This page of analytics_metrics, in the requested order.
next_page_tokenOpaque. Absent or empty means this was the last page.
total_sizeRows in the whole filtered collection, not in this page.
Get analytics_metric
What this website's analytics can count, one row per metric, with what each number means and which periods and intervals it accepts. Nothing here is stored or writable: it is the platform's catalogue, and a metric your client does not recognise is one it should skip rather than fail on. The numbers themselves come from :query on one of these rows.
path Parameters
website_idId of the parent website.
analytics_metric_idId of the parent analytics_metric.
Headers
If-None-MatchA matching etag answers 304 with no body (§16).
Get analytics_metric › Responses
The resource.
nameThe resource name (§5) — the identity of this resource, and the path that addresses it: websites/{website}/cms_pages/{cms_page}. It is the handle to store, not a human label.
idThe last segment of name on its own, for a client that needs to build a child URL. Unique inside its parent, never across the platform.
create_timeWhen the resource was created (RFC 3339, UTC).
update_timeWhen the resource last changed (RFC 3339, UTC).
etagVersion of the persisted state. Send it back in If-Match on Update or Delete and the write is rejected with ABORTED if anyone else changed the resource meanwhile (§14).
display_nameThe metric's name as a person reads it, for a widget's title or a picker.
descriptionWhat the number means and — just as importantly — what it leaves out, in a sentence or two a widget can show as help text.
unitWhat the number is measured in. COUNT is the only unit today; it is an enum because response times and rates are the next metrics and they are not counts.
kindEXACT for a counter, ESTIMATED for a number computed from a sketch. Everything ESTIMATED answers approximate: true on :query, and is accurate to about 1.6 %.
supported_intervalsThe steps :query can return a series in: MINUTE, HOUR, DAY. Empty means the metric is a single number and its answer carries no points at all.
supported_periodsThe windows :query accepts: TODAY, LAST_7_DAYS, LAST_30_DAYS, CUSTOM. Empty means the metric measures its own window ending now and takes no period.
default_intervalThe step :query returns when the caller names no interval — except for TODAY, which steps by HOUR so that today is a shape rather than one bar. Absent on a metric with no series.
rolling_windowFor a live metric, the window it always measures, as a duration in seconds (300s). Absent on every metric that takes a period instead.
Query (analytics_metrics)
Measures this metric over a window and answers the number, with the series behind it.
A GET custom method, because it is a read no List filter can express (§10): the answer is a measurement, not a resource, and it takes its arguments as query parameters.
The window comes back resolved — the absolute instants TODAY or LAST_7_DAYS turned out to be, and the time_zone the days were cut in, which is the website's own tracking.site_analytics.time_zone and neither the caller's nor the browser's. Without those two fields "today" is a number nobody can reproduce. LAST_7_DAYS and LAST_30_DAYS are whole days ending at today's local midnight; today itself is TODAY.
points steps by interval and is absent — not empty — for a metric that has no series. approximate is true whenever the number came from a sketch rather than a counter.
Refused rather than answered approximately: an interval the metric does not support, a range that would be more than 800 points, a range old enough to need minute buckets the retention no longer keeps, start_time/end_time on a named period or missing on a CUSTOM one, and a filter field other than language.
path Parameters
website_idId of the parent website.
analytics_metric_idId of the parent analytics_metric.
query Parameters
periodWhich window to measure. CUSTOM requires start_time and end_time; every other value refuses them. Days are cut in the website’s own time zone, and the response says which instants that turned out to be.
start_timeInclusive start of a CUSTOM period, RFC 3339.
end_timeExclusive end of a CUSTOM period, RFC 3339.
intervalThe step of the returned series. Defaults to HOUR for TODAY and DAY otherwise; a metric that supports no interval returns no series at all. A range that would exceed 800 points is INVALID_ARGUMENT.
filterAIP-160 subset (§8). Filterable: language. A field outside the list is INVALID_ARGUMENT.
compareAdds previous_value, measured over a window of equal length ending where this one starts.
Query (analytics_metrics) › Responses
The method’s own response object (§10).