Platform feature. Requires
WANIWANI_API_KEY. Works whether your MCP server is self-hosted or on Managed Hosting. About the Platform.client.track(). The SDK accepts a strongly typed TrackEvent shape and maps it to the canonical Events API V2 envelope before sending.
For the full type-level reference (the TrackEvent shape, the EventType union, all *Properties interfaces), see Event schema. This page is the usage guide.
Revenue helpers
The five revenue funnel events have flat typed helpers ontrack. Each accepts its event’s properties plus the shared tracking context (sessionId, externalUserId, meta).
The helpers are flat on
track (there is no track.revenue.* namespace). Inside a flow node, call them on the scoped client from the handler context, which carries session identity automatically:
lead_qualified means the person met your qualification bar. Emit it once per flow run, at the node where qualification completes. Where each revenue event belongs in a flow is covered in Instrumentation.
Recipes
quote.requested / quote.succeeded / quote.failed
link.clicked
purchase.completed
Return value
eventId is stable and safe to log. It is assigned before the envelope leaves the process, so logging it tells you an event was accepted into the buffer, not that it reached the backend. track() returns as soon as the envelope is enqueued, before the network request completes.
Sessions and users
Passmeta: extra._meta from inside a tool handler so the event is linked to the active MCP session. See Sessions. To attach a user identifier, pass externalUserId or call client.identify(). See Identify.
Flushing
The transport flushes on a timer and on batch size. In long-running processes, you typically do not need to callflush() yourself. In serverless functions, call it before the function returns: