All stats endpoints require authentication (session cookie). Responses are JSON.
Query Parameters
These parameters work across all /api/stats/* endpoints:
| Parameter | Type | Default | Description |
|---|---|---|---|
| start | ISO 8601 | — | Start date (e.g. 2024-01-01T00:00:00Z) |
| end | ISO 8601 | — | End date |
| days | integer | 7 | Days back from today (alternative to start/end) |
| domain | string | — | Filter by domain |
| country | string | — | Filter by country code |
| browser | string | — | Filter by browser name |
| device | string | — | Filter by device type (mobile, desktop, tablet) |
| page | string | — | Filter by page path |
| referrer | string | — | Filter by referrer (partial match) |
| bot_filter | string | Exclude bots | Bot traffic filter (see below) |
Bot Filter Values
| Value | Description |
|---|---|
| (default) | Exclude all bots (is_bot = 0) |
| all | Include all traffic |
| humans | Only human visitors |
| bots | Only bot traffic |
| good_bots | Only good bots (search engines, etc.) |
| bad_bots | Only malicious/suspicious bots |
| suspicious | Only suspicious traffic |
Endpoints
Overview
GET /api/stats/overview
Returns summary statistics: total_events, unique_visitors, sessions, pageviews, bounce_rate, avg_session_seconds, live_visitors.
Timeseries
GET /api/stats/timeseries
Returns pageviews over time: period, pageviews, visitors.
Pages
GET /api/stats/pages
Returns top pages: path, views, visitors.
Referrers
GET /api/stats/referrers
Returns traffic sources: source, referrer_type, visits, visitors.
Geographic
GET /api/stats/geo
Returns geographic breakdown: country, visitors.
GET /api/stats/map
Returns map data with coordinates: city, country, lat, lng, visitors, pageviews.
Devices & Browsers
GET /api/stats/devices
Returns device breakdown: device, visitors.
GET /api/stats/browsers
Returns browser breakdown: browser, visitors.
Campaigns
GET /api/stats/campaigns
Returns UTM campaign data: utm_source, utm_medium, utm_campaign, sessions, visitors.
Custom Events
GET /api/stats/events
Returns custom event counts: event_name, count, unique_visitors.
Outbound Links
GET /api/stats/outbound
Returns outbound click data: url, clicks, unique_visitors.
Bots
GET /api/stats/bots
Returns bot traffic breakdown including categories, score distribution, timeseries, and top bots.
Core Web Vitals
GET /api/stats/vitals
Returns Web Vitals distributions: LCP, FCP, CLS, INP, TTFB.
Errors
GET /api/stats/errors
Returns JavaScript error data: error_hash, error_message, count, affected_visitors.
Fraud Detection
GET /api/stats/fraud
Returns fraud analysis summary.