Skip to content
Docs menu · Custom events

Features

Custom Events With track()

Tag moments in a recording with track(): naming rules, the 4 KB property limit, queueing before recording starts, timeline markers and session filters.

A custom event puts a named marker on a session's timeline at the moment it happened: a checkout started, a feature flag evaluated, an error your code caught. Reviewers can jump to it in the player, see its properties in the event list, and filter the session list to sessions that contain it.

Tracking an event

anyreplay('track', 'checkout_started', { cart: 3, currency: 'EUR' });

The React Native SDK takes the same names and properties under the same rules. Screen changes are recorded as markers of their own; see navigation tracking.

Rules

Rule
Name1–64 characters of A–Z a–z 0–9 _ . : -. No spaces and no $.
PropertiesOptional. A plain JSON object (not an array) of at most 4 KB once serialised.
Per chunkIngest indexes at most 200 custom events per chunk.
Per sessionIngest indexes at most 5,000 custom events per session.

A call that breaks a rule is dropped, never thrown: track usually runs inside your own click handlers, and an exception there would break the click. Turn on debug: true to see a console warning with the reason. Properties are copied when you call track, so changing the object afterwards does not change what was recorded.

anyreplay('track', 'plan selected');            // dropped: space in the name
anyreplay('track', 'plan_selected', ['team']);   // dropped: properties must be an object
anyreplay('track', 'plan_selected', { plan: 'team' }); // recorded

Before recording starts

Events tracked while the recorder is not yet recording — waiting for consent, or while the page is still loading — are queued, up to 32 of them, and emitted right after the first snapshot. They are stamped with the time they are emitted rather than the time you called track, so they land on the timeline just after the recording begins. Events tracked after the recorder has stopped are dropped.

How events travel

An event is recorded inside the same stream as everything else, so it carries the recording's clock and replays in order. When the chunk reaches ingest, the event is also copied into an index — that is what powers the event list in the player and the Has event filter in the session list. Route changes in single-page apps use the same mechanism under the reserved name $navigate.

Naming conventions that age well

  • Use object_action in the past or present tense consistently: checkout_started, invoice_downloaded.
  • Put variable parts in properties, not in the name: plan_selected with { plan: 'team' }, not plan_team_selected. The filter matches whole names.
  • Namespaces with . or : are allowed: billing.invoice_downloaded.
  • Do not put personal data in properties. They are stored as sent and are not masked.