SublimDocs

Events HTTP API

This is the endpoint the tracker sends its events to. It is documented for debugging, for proxies and for custom browser clients. On a website, use the tracker: it adds the page context, retries failed requests and handles everything else on this page for you.

Built for browsers

Visitors and sessions are identified from the request's IP and user agent, and server, bot and private-network traffic is filtered out. Events sent from your back end would therefore be attributed to your server, or dropped. To send data from your back end, such as transactional emails, use the Server API.

Request

HTTP
POST https://tracker.sublimanalytics.com/api/v2/events
Content-Type: application/json
X-Project: YOUR_PROJECT_ID
JSON
{
  "n": "appointment_booked",
  "u": "https://example.com/booking/confirmed",
  "d": "example.com",
  "l": "fr-FR",
  "p": { "service": "piercing" },
  "amount": 45,
  "currency": "EUR"
}

Headers

HeaderDescription
X-ProjectRequired. Your project ID.
X-WorkspaceOptional. Alone, the project is resolved from the site's domain (beta).
Content-Typeapplication/json

Body fields

FieldTypeDescription
nstringRequired. Event name: page_view, engagement or any custom name.
ustringFull page URL.
dstringHostname of the page.
rstringReferrer (pageviews).
tstringPage title (pageviews).
lstringBrowser language, such as fr-FR.
w, hnumberViewport width and height (pageviews).
sw, shnumberScreen width and height (pageviews).
sdnumberScroll depth, in % (engagement).
enumberEngaged time, in ms (engagement).
pobjectProperties. Values are stored as text; keep them flat.
amountnumberRevenue amount.
currencystringISO 4217 currency of amount.

The event's time is the moment the server receives it.

Responses

StatusBodyMeaning
202{"sv": 12}Accepted. sv is the project settings version, used by the tracker to refresh its cached settings.
400{"error": "…"}Invalid JSON, missing or unknown project.
403{"error": "domain not allowed"}The project's domain protection rejected the page's domain.
503{"error": "event queue full"}Temporarily overloaded. The tracker retries such events later.

Other endpoints used by the tracker

EndpointPurpose
GET /api/v2/project/{projectId}/settingsProject settings: cart and thank-you URLs, dataLayer configuration.
POST /api/v2/replaySession replay batches.