step(). Pageviews are events too, named $pageview and recorded for you when tracking is on; Pageviews and sessions covers those. Events queue in memory and leave in batches, so tracking costs the page a few requests a minute at most.
Tracking an event
Callstep() with a name and an optional properties object:
name: a string between 1 and 100 characters that identifies the action.properties: an optional plain object with key-value metadata. Every value must be JSON-serializable.
Event names must be 1–100 characters and properties a plain object (class instances and top-level arrays are rejected). Invalid calls log a
[Wendung - Warning] and are ignored; nothing throws. Circular references surface later, at serialization time: the whole batch is dropped with a Failed to serialize batch warning.Event payload structure
Eachstep() call snapshots the current session ID, identity, and page context at track time. The queued event takes this shape:
Full request payload
When a batch is flushed, the SDK POSTs anEventRequestPayload to the ingest endpoint. Your API key is sent in the X-API-Key header, not in the body:
sentAt reflects when the batch was dispatched. Per-event timing is preserved in each event’s own timestamp, and each event carries its own identity and context snapshots.
Naming events
Names are the contract between your code and your funnels, so pick a convention and stick to it:Use snake_case
Use snake_case
Lowercase words joined by underscores are the most portable format across analytics tools and databases.
Use past-tense action verbs
Use past-tense action verbs
Events describe things that already happened, so the name should reflect that.
Be specific and descriptive
Be specific and descriptive
Avoid generic names that are hard to distinguish in dashboards.
Using properties
Properties are key-value metadata on one event, and they are what you filter and slice by later. Put things there that are specific to that moment. Anything true of the user in general belongs inidentify() traits instead.