POST
/track
Submit tracking events

Accepts a batch of page_view, page_progress, page_timing, link_click, performance, and browser_environment events. Tenant is supplied in the body (not a header) since browser clients may use sendBeacon(). The whole batch is validated before anything is written — a malformed batch stores nothing.

Request body

{
  "tenantId": "...",
  "anonymousId": "...",
  "userId": "optional-if-logged-in",
  "events": [
    { "type": "page_view", "pageViewId": "...", "occurredAt": "...", "page": { "url": "...", "path": "..." } }
  ]
}

Response

{
  "data": {
    "visitorId": 123,
    "acceptedEvents": 1
  }
}

Limits

  • Up to 100 events per batch
  • occurredAt must be within 5 minutes in the future / 24 hours in the past
  • Rate-limited per tenant + IP
PUT
/visitor/:anonymousId/user/:userId
Link an anonymous visitor to a user

Call this immediately after your application authenticates a visitor. If the anonymous identity already belongs to one visitor and the user identity to another, the two are merged into one canonical visitor — historical events follow the merge.

Request body

{ "tenantId": "..." }

Response

{
  "data": {
    "visitorId": 123,
    "anonymousId": "abc",
    "userId": "456"
  }
}