Events & 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.
Anatomy of the payload
| 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" } } Properties (props)
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' } }) 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 |
Revenue ($)
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.
revenue goes through the instance returned by init() — see the API reference.See also
- Configuration — endpoint and flags that generate automatic events (outbound links, files).
- Privacy — when an event is not sent.