Sending Stats

POST NEXT_PUBLIC_API_URL/send

Send analytics events, page views, visitor identities, and Web Vitals metrics directly to the ingestion pipeline.

This endpoint is public and does not require an Authorization header. However, a valid User-Agent HTTP header must be included.

Endpoint

POST NEXT_PUBLIC_API_URL/send

Parameters

FieldTypeDescription
typestringRequired. Event type: event, identify, or performance.
payload.projectstringRequired (unless using link or pixel). The project ID.
payload.linkstringLink UUID (alternative to project).
payload.pixelstringPixel UUID (alternative to project).
payload.urlstringCurrent page URL path (e.g. /docs).
payload.titlestringPage title.
payload.referrerstringReferrer URL.
payload.hostnamestringHostname (e.g. myapp.com).
payload.languagestringBrowser language (e.g. en-US).
payload.screenstringScreen resolution (e.g. 1920x1080).
payload.namestringCustom event name (e.g. button_click, subscribe).
payload.tagstringOptional categorization tag.
payload.idstringCustom distinct visitor or session identifier.
payload.dataobjectArbitrary key-value metadata for the custom event.
payload.lcpnumberLargest Contentful Paint (ms).
payload.inpnumberInteraction to Next Paint (ms).
payload.clsnumberCumulative Layout Shift.
payload.fcpnumberFirst Contentful Paint (ms).
payload.ttfbnumberTime to First Byte (ms).
payload.emailstring(for identify calls) Visitor email address.
payload.firstNamestring(for identify calls) Visitor first name.
payload.lastNamestring(for identify calls) Visitor last name.
payload.propertiesobject(for identify calls) Custom user profile traits.

Page View / Custom Event Example

{
  "type": "event",
  "payload": {
    "project": "3b290947-8a3d-4cbf-8468-b328a6fcf7bb",
    "hostname": "myapp.com",
    "language": "en-US",
    "referrer": "https://google.com",
    "screen": "1920x1080",
    "title": "Pricing Page",
    "url": "/pricing",
    "name": "view_pricing",
    "data": {
      "plan": "pro",
      "billing": "annual"
    }
  }
}

Identify Call Example

{
  "type": "identify",
  "payload": {
    "project": "3b290947-8a3d-4cbf-8468-b328a6fcf7bb",
    "id": "usr_abc123",
    "email": "jane@example.com",
    "firstName": "Jane",
    "lastName": "Doe",
    "properties": {
      "role": "Founder",
      "companySize": "10-50"
    }
  }
}

Web Vitals / Performance Example

{
  "type": "performance",
  "payload": {
    "project": "3b290947-8a3d-4cbf-8468-b328a6fcf7bb",
    "url": "/dashboard",
    "lcp": 1240,
    "cls": 0.02,
    "fcp": 890,
    "ttfb": 150
  }
}

Sample response

{
  "cache": "eyJhbGciOiJIUzI1NiIs..."
}

POST NEXT_PUBLIC_API_URL/batch

Send an array of events in a single HTTP request for high-throughput client flushes or server-side background queues.

Request body

A JSON array of event objects matching the /send payload format:

[
  {
    "type": "event",
    "payload": {
      "project": "3b290947-8a3d-4cbf-8468-b328a6fcf7bb",
      "url": "/pricing",
      "name": "view_pricing"
    }
  },
  {
    "type": "event",
    "payload": {
      "project": "3b290947-8a3d-4cbf-8468-b328a6fcf7bb",
      "url": "/checkout",
      "name": "checkout_started"
    }
  }
]

Sample response

{
  "size": 2,
  "processed": 2,
  "errors": 0,
  "details": [],
  "cache": "eyJhbGciOiJIUzI1NiIs..."
}

POST NEXT_PUBLIC_API_URL/errors

Ingest client-side runtime errors and unhandled exceptions (batched up to 20 spans per request).

Request body

A JSON array of error objects:

[
  {
    "project": "3b290947-8a3d-4cbf-8468-b328a6fcf7bb",
    "errorType": "TypeError",
    "message": "Cannot read properties of undefined (reading 'map')",
    "filename": "https://myapp.com/assets/main.js",
    "lineno": 142,
    "colno": 28,
    "stack": "TypeError: Cannot read properties of undefined...\n  at render (https://myapp.com/assets/main.js:142:28)",
    "path": "/dashboard",
    "hostname": "myapp.com",
    "level": "error"
  }
]

Sample response

{
  "status": "ok",
  "count": 1
}