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, "visits": 12980, "pageviews": 15230, "revenue": 1834.5, "aiVisitors": 190,
"bounceRate": 0.41, "noReadRate": 0.27, "avgSessionSeconds": 96, "conversions": 22, "conversionRate": 0.0046, "conversionRatePerVisit": 0.003,
"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 | Goal events received. Your configured goals are always included, even when rare. |
| 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. |
A note on limit for goals
limit caps the ranking by volume, but the goals you configured are returned on top of it. Asking for one row can therefore return two: the busiest event, plus your own goal. That is deliberate. A goal you explicitly created should never vanish from a list because five other events happen more often — and it used to vanish more as the period grew longer, which is the opposite of what anyone expects.
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_…"