The metrics mutation retrieves page analytics data for a given URL over a specified number of days. This includes page views, visits, conversions, durations, geographic data, referrers, page speed metrics, and Google Search Console data.
GraphQL Page Metrics
Usage
mutation {
metrics(url: "https://mydomain.tld/blog", days: 30, lang: "en") {
errors
views { key value }
visits { key value }
conversions { key value }
durations { key value }
countries { key value }
referrers { key value }
pagespeed { key value rows { key value } }
impressions { key value }
clicks { key value }
queries { key impressions clicks ctr position }
}
}
Arguments:
url:String!— The full URL of the page to get metrics for (required).days:Int— Number of days to look back (optional).lang:String— ISO language code for locale-specific data (optional).
Return Types
Stats
The Stats type contains the following fields:
| Field | Type | Description |
|---|---|---|
errors |
[String!] |
List of errors that occurred while fetching metrics |
views |
[StatsNumber!] |
Number of page views by day |
visits |
[StatsNumber!] |
Number of page visits by day |
conversions |
[StatsNumber!] |
Number of conversions on page by day |
durations |
[StatsNumber!] |
Average page visit duration in seconds by day |
countries |
[StatsNumber!] |
Number of page visits by country |
referrers |
[StatsNumber!] |
Number of page visits by referring website |
pagespeed |
[StatsNumber!] |
Page Speed related values |
impressions |
[StatsNumber!] |
Number of Google Search impressions |
clicks |
[StatsNumber!] |
Number of Google Search clicks |
queries |
[StatsQuery!] |
List of search queries |
StatsNumber
| Field | Type | Description |
|---|---|---|
key |
String! |
Date in ISO format (YYYY-MM-DD) or descriptive string |
value |
Float |
Numeric value (views, visits, etc.) |
rows |
[StatsNumber!] |
List of individual sub-rows |
StatsQuery
| Field | Type | Description |
|---|---|---|
key |
String! |
Query string |
impressions |
Int |
Number of page impressions in Google Search results |
clicks |
Int |
Number of page clicks in Google Search results |
ctr |
Float |
Click through rate in Google Search (between 0 and 1) |
position |
Float |
Position in Google Search results |
Example Response
{
"data": {
"metrics": {
"errors": [],
"views": [
{ "key": "2026-03-01", "value": 150 },
{ "key": "2026-03-02", "value": 203 }
],
"visits": [
{ "key": "2026-03-01", "value": 98 },
{ "key": "2026-03-02", "value": 125 }
],
"countries": [
{ "key": "US", "value": 450 },
{ "key": "DE", "value": 120 }
],
"queries": [
{
"key": "laravel cms",
"impressions": 1200,
"clicks": 85,
"ctr": 0.071,
"position": 4.2
}
]
}
}
}