Skip to content
Docs

Counts page views

GEThttps://api.vercel.com/v1/query/web-analytics/visits/count
Counts the number of page views on a project (production only), since Web Analytics was enabled. Results can be filtered on supported dimensions.
https://api.vercel.com/v1/query/web-analytics/visits/count
const response = await fetch('https://api.vercel.com/v1/query/web-analytics/visits/count?projectId=string&since=value&until=value&filter=string&teamId=string&slug=string', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json',
},
});
const data = await response.json();
console.log(data);
Response
{
"data": {
"browserName": "Example Name",
"country": "string",
"deviceType": "string",
"environment": "string",
"flags": "string",
"osName": "Example Name",
"projectId": "example_id",
"projectName": "Example Name",
"referrerHostname": "Example Name",
"requestHostname": "Example Name",
"requestPath": "string",
"route": "string",
"utmCampaign": "string",
"utmContent": "string",
"utmMedium": "string",
"utmSource": "string",
"utmTerm": "string",
"visitorId": "example_id"
},
"query": {
"filter": "string",
"since": "string",
"until": "string"
},
"version": "123"
}
AuthorizationbearerToken

Default authentication mechanism

projectIdstringRequired
The project identifier or the project name
sinceanyOptional
Timestamp in milliseconds, or a valid Date string.
Selects data from (including) this date and time. Will be adjusted according to the desired time granularity.
untilanyOptional
Timestamp in milliseconds, or a valid Date string.
Selects data until (including) this date. Will be adjusted according to the desired time granularity.
filterstringOptional
OData-compliant filter. Encode the value when sending it in a URL.
Allows filtering on one or multiple dimensions.
Supported dimensions: country, deviceType, environment, requestPath, referrerHostname, osName, browserName, route, utmSource, utmMedium, utmCampaign, utmContent, utmTerm.
JSON dimensions filtered by key: flags/, for example flags/beta_banner eq 'true'. Wrap keys containing characters other than letters, digits, and underscores in single quotes, for example flags/'my-flag' eq 'true'.
Supported operations include eq, ne, in, and logical operators and, or, not with parentheses. Functions such as startswith are supported by the OData parser.
teamIdstringOptional
The Team identifier to perform the request on behalf of.
slugstringOptional
The Team slug to perform the request on behalf of.
200Success
dataobjectRequired2 variants
queryobjectRequired
versionnumberRequired
400One of the provided values in the request query is invalid.
401The request is not authorized.
402Error
403You do not have permission to access this resource.
404Error
410Error
503Error