-
Notifications
You must be signed in to change notification settings - Fork 0
Events and Payload
Each event is posted to the endpoint as compact JSON. The keys are deliberately short — every byte counts on the wire — and frozen: Takt ingestion depends on them, do not rename them.
| Key | Meaning | Example |
|---|---|---|
n |
event name (pageview for views) |
"Signup" |
d |
domain | "example.com" |
u |
page URL | "https://example.com/pricing" |
r |
referrer | "https://google.com" |
w |
viewport width (px) | 1440 |
p |
props (object, omitted if empty) | { "plan": "pro" } |
$ |
revenue { a: amount, c: currency }
|
{ "a": "29", "c": "EUR" } |
A pageview therefore looks like this on the wire:
{ "n": "pageview", "d": "example.com", "u": "https://example.com/pricing", "r": "", "w": 1440 }And a custom event with props:
{ "n": "Signup", "d": "example.com", "u": "https://example.com/signup", "r": "", "w": 1440, "p": { "plan": "pro" } }Props split a single event into sub-categories you can analyze in the dashboard. Keep them simple and low-cardinality (plan, country, button type) — no unique identifier and no personal data.
window.takt('Signup', { props: { plan: 'pro', method: 'google' } })Never send personal data in
props(email, identifier, name). Takt is designed to stay anonymous — high-cardinality props break this model and aggregation.
props are sanitized before sending: non-string values are coerced to strings, empty values ('', null, undefined) are dropped, and limits are enforced (the event still sends, a console warning fires once):
| Limit | Value |
|---|---|
| Number of keys | 30 max (extras dropped) |
| Key length | 64 characters |
| Value length | 1024 characters |
To track revenue, attach an amount and a currency. The amount is a string (to avoid floating-point imprecision) and the currency is an ISO 4217 code (uppercased on send).
// snippet (global window.takt)
window.takt('Purchase', {
props: { plan: 'pro' },
revenue: { amount: '29', currency: 'EUR' }
})On the wire, this becomes the compact key $: { "a": "29", "c": "EUR" }.
Revenue is validated: the amount must match \d+(\.\d{1,2})? (integer or up to 2 decimals) and the currency be a 3-letter code. If either is malformed, the revenue is dropped (the rest of the event still sends) with a console warning.
In an npm integration,
revenuegoes through the instance returned byinit()— see the API reference.
- Configuration — endpoint and flags that generate automatic events (outbound links, files).
- Privacy — when an event is not sent.
Source: github.com/vskstudio/takt-core · npm @vskstudio/takt-core
- Home
- The-Snippet
- Installation
- Configuration
- Vanilla-JS
- Events-and-Payload
- Privacy
- Widgets
- API-Reference
React · Vue · Svelte wrappers: see the docs site.