Analytics
API endpoints for consent analytics — summary counts and daily timeline data.
Analytics endpoints aggregate consent events into meaningful statistics. All endpoints require API key authentication and site ownership.
Summary
GET /api/v1/analytics/:siteId/summaryReturns aggregate totals across all time:
{
"siteId": "550e8400-e29b-41d4-a716-446655440000",
"totalAccepts": 1250,
"totalRejects": 340,
"totalCustom": 110,
"total": 1700
}Timeline
GET /api/v1/analytics/:siteId/timeline?from=2026-01-01&to=2026-02-01| Parameter | Type | Description |
|---|---|---|
from | date string | Start date (optional) |
to | date string | End date (optional) |
Returns daily stats ordered by date:
{
"siteId": "550e8400-e29b-41d4-a716-446655440000",
"stats": [
{
"date": "2026-01-15",
"acceptCount": 45,
"rejectCount": 12,
"customCount": 3
},
{
"date": "2026-01-16",
"acceptCount": 52,
"rejectCount": 8,
"customCount": 5
}
]
}How Aggregation Works
Individual consent events are aggregated into daily stats on a scheduled basis. Summary and timeline endpoints always read from the pre-aggregated table, so response shape and latency are stable regardless of event volume.