custom events
Analyse your own events
Count any event you send, break it down by any property you attach to it, and measure it against pageviews. Built for affiliate clicks, and just as useful for add-to-cart by variant or feature-used by plan.
/api/v1/sites/{id}/events/{name}| Param | Type | Description |
|---|---|---|
| from / to | date | Absolute window, YYYY-MM-DD. Falls back to range. |
| range | string | 7d, 30d, 90d… when you prefer a rolling window. |
| grain | string | hour, day, week or month. Drives the time series. |
| dimension | string | A column, or props.<key> to group by one of your own properties. |
| filter[key] | string | Repeatable. Same keys as dimension, including props.<key>. |
| limit | number | Rows in the breakdown. 1 to 500, default 100. |
Dimensions and filters
Columns: pathname, channel, device, browser, os, country, referrer, utm_source, utm_medium, utm_campaign. Anything else must be one of your own properties, written props.<key>.
An unknown key returns 400 rather than unfiltered numbers. Correct totals for a question you did not ask are worse than an error.
curl "https://datalenk.com/api/v1/sites/3/events/affiliate_click\ ?from=2026-08-01&to=2026-08-15&grain=day&dimension=props.link_id\ &filter[channel]=Organic%20Search" \ -H "Authorization: Bearer dlk_live_…"
{
"range": "2026-08-01 to 2026-08-15",
"data": {
"name": "affiliate_click",
"events": 1284,
"uniqueVisitors": 903,
"pageviews": 41200,
"eventRate": 3.12,
"series": [ { "day": "2026-08-01", "events": 74, "visitors": 61 } ],
"dimension": "props.link_id",
"breakdown": [
{ "key": "decathlon:featured_card:bike-123", "events": 210, "visitors": 173 },
{ "key": "amazon:inline:helmet-77", "events": 145, "visitors": 122 }
],
"note": "eventRate is omitted: a pageview carries no event properties, so a rate by property has no denominator."
}
}Why the rate sometimes disappears
eventRate is events divided by pageviews. Grouped by a column such as pathname, every row gets its own rate: that is your click-through per page. Grouped by one of your properties, there is no denominator, because a pageview does not carry the properties of an event. The field is then left out and the response says so, rather than showing you a zero you would have to interpret.
What comes back
Counts and aggregates only. Visitors are counted, never listed. To follow one of them, use /visitors/<visitorId> with a key from your CSV export.