wani.track(). Usage recipes are in Events.
TrackEvent
The event name. Must be one of the built-in
EventType values listed below.Event payload. For built-in events, the type is narrowed (for example,
quote.succeeded expects { amount?: number; currency?: string }).MCP request metadata, typically
extra._meta inside a tool handler. This is where the SDK reads the session id from. See Sessions.Explicit session id override. Prefer passing
meta instead.External user identifier. Equivalent to calling
identify() inline. See Identify.Client-generated id. If you omit it, the SDK generates
evt_<uuid>. Supplying your own enables idempotent resends.track() returns { eventId } as soon as the envelope is enqueued, before the network request completes.
EventType union
A closed union exported from @waniwani/sdk. Only these names are accepted by track().
The five revenue events also have flat typed helpers on
track (for example wani.track.leadQualified({ ... })). Each helper accepts its event’s properties plus the shared tracking context (sessionId, externalUserId, meta, and so on). Placement guidance for each lives in Instrumentation.
Typed property interfaces
The SDK also defines
widget_render, widget_click, widget_link_click, widget_error, widget_scroll, widget_form_field, and widget_form_submit event types. These are emitted automatically by the widget runtime (useWaniwani() in a browser widget) and are not intended to be sent from server code.