stats
One route, every metric
All aggregated analytics come from a single endpoint. Pick a dataset, add a period and optional filter.
GET
/api/v1/sites/{id}/stats/{dataset}curl "https://datalenk.com/api/v1/sites/3/stats/summary?range=7d" -H "Authorization: Bearer dlk_live_…"
response
{
"range": "Last 7 days",
"data": {
"visitors": 8420, "pageviews": 15230, "revenue": 1834.5, "aiVisitors": 190,
"bounceRate": 0.41, "avgSessionSeconds": 96, "conversions": 22, "conversionRate": 0.0046,
"delta": { "visitors": 0.12, "revenue": 0.08 }
}
}Datasets
| Dataset | Returns |
|---|---|
| summary | Visitors, pageviews, revenue, AI traffic, bounce, avg session, conversion rate, plus deltas. |
| timeseries | Per-bucket series. Add ?newReturning=1 for the new vs returning split. |
| revenue | Revenue by channel plus new / renewal / expansion breakdown. |
| keywords | Search queries with clicks, impressions, position, CTR and attributed revenue. |
| goals | Configured goals and their conversions. |
| web-vitals | Speed score plus LCP / FCP / TTFB / CLS / INP (p75), by device, slowest pages. |
| online | Live visitors right now (never cached). |
| ai-crawlers | AI bot visits by crawler. |
| channels · referrers · campaigns | Acquisition sources. |
| pages · entry-pages · exit-links | Content. |
| countries · regions · cities | Geography. |
| devices · browsers · os · languages | Audience. |
| ai-engines · search-engines · social | Detailed sources. |
Dimension datasets
Channels, pages, devices and the other dimension datasets return the same row shape:
response
{
"range": "Last 7 days",
"data": [
{ "key": "Organic Search", "visitors": 5120, "revenue": 980.5, "conversions": 12 },
{ "key": "Direct", "visitors": 1900, "revenue": 420.0, "conversions": 5 }
]
}Combine period, filter and limit freely, for example the top pages that Organic Search brought over the last 30 days:
curl "https://datalenk.com/api/v1/sites/3/stats/pages?range=30d&filter[channel]=Organic%20Search&limit=20" \ -H "Authorization: Bearer dlk_live_…"