Public Web Analytics API now available
By Steven Van ·
The API exposes page view and custom event data grouped by time, route, country, device or feature flag, matching the dashboard's numbers.
Vercel's Web Analytics data is now available through a public API rather than just the dashboard. The API reads from the same aggregated data model that powers the dashboard, so a query and the on-screen numbers match.
Two resources are exposed: visits for automatically tracked page views, and events for custom events sent with track(). Count endpoints return a single total, such as lifetime page views for a post. Aggregate endpoints return rows grouped by time, route, country, referrer, device, feature flag, or custom event data, using OData-syntax filters and a by parameter to set the grouping.
Vercel points to two uses: building custom reports, or embedding live traffic metrics in a customer-facing admin panel. For raw, unaggregated event streams, data can instead be forwarded to external infrastructure with Drains. Authentication setup, full filter syntax, and response schemas are covered in the Web Analytics API guide.