Send events
Receives page views, custom events, engagement and identify events, and the heatmap script's clicks and scroll depths, one or a list of up to 100 (500 KB at most). Clicks and scroll depths are stored apart from events (for Analytics → Heatmaps, F80–F82) and are never counted as events in reports. Served on a region's events host, https://us.e.vk.viabio.me/v1/events.
Through a proxy on the customer's own domain, the same endpoint answers at /va/e. The proxy sets X-Forwarded-For to the visitor's address and may send the visitor's location in X-Viakite-Country (two letters), X-Viakite-Region and X-Viakite-City (URL-encoded), which come before the edge's own.
From a browser (the script and @viakite/sdk): no Authorization header; every event names the project's public key (pk_…) in project. The visitor comes from the request: its address and user agent (hashed, then dropped), and the edge's location.
From a server: send a secret key (Authorization: Bearer sk_…) with the analytics.send scope, and name the project by its id (prj_…) in every event's project. The server's own user agent is never counted as a bot and its location is not used. Pass the visitor's ip and user_agent to tell visitors apart, to read the device and to apply bot rules and excluded addresses; without them, an event with a user_id counts that user as one visitor for the day.
The answer is always 202 once the key is good, with how many events were stored and how many dropped (bots, excluded visitors, hostnames not allowed, invalid events, or a plan's limit). An event with an id already received is stored once, so retrying a request is safe.
Body
Show 25 fieldsHide fields
pageview needs url; event needs name; engagement needs pageview_id; identify needs user_id; click and scroll (the heatmap script) need url, pageview_id and viewport, and a click needs x (0 to 1) and y (0 or more).pagevieweventengagementidentifyclickscrollpk_…) from a browser, or its id (prj_…) with a secret key.en-IN.ts, it corrects the sender's clock (up to 24 hours back).event), cut to 120 characters.revenue and currency record money.identify), with the same limits as props.id an engagement event belongs to.engagement, and to the percent (0 to 100) on scroll.click's horizontal position as a share of the page's width, 0 to 1.click's vertical position in pixels from the top of the page.click, scroll): under 768 is mobile, under 1,024 tablet, desktop from there.click, scroll).click's target as a short CSS selector (tag, id, classes); never its text.Show 25 fieldsHide fields
pageview needs url; event needs name; engagement needs pageview_id; identify needs user_id; click and scroll (the heatmap script) need url, pageview_id and viewport, and a click needs x (0 to 1) and y (0 or more).pagevieweventengagementidentifyclickscrollpk_…) from a browser, or its id (prj_…) with a secret key.en-IN.ts, it corrects the sender's clock (up to 24 hours back).event), cut to 120 characters.revenue and currency record money.identify), with the same limits as props.id an engagement event belongs to.engagement, and to the percent (0 to 100) on scroll.click's horizontal position as a share of the page's width, 0 to 1.click's vertical position in pixels from the top of the page.click, scroll): under 768 is mobile, under 1,024 tablet, desktop from there.click, scroll).click's target as a short CSS selector (tag, id, classes); never its text.Responses
Received; the counts of stored and dropped events.
1{2"accepted": 1,3"dropped": 14}
Errors
Every error has the same shape: error.code, a message for people and details.
| Status | Code |
|---|---|
missing_key | |
unauthorized | |
not_found | |
forbidden | |
missing_project | |
mixed_projects | |
too_many_events | |
validation_error | |
bad_request |