DocumentationEvents API

Events API

The SDK calls this endpoint internally. You can also call it directly from a server or any HTTP client.

POST /api/tracker/track/

bash
curl -X POST https://www.nohmo.in/api/tracker/track/ \
-H "Content-Type: application/json" \
-H "X-API-Key: pk_xxxx" \
-d '{
"events": [
{
"deviceId": "a1b2c3d4...",
"sessionId": "sess_xxxx",
"event": "PAGE_VIEW",
"page": "/pricing",
"referrer": "https://google.com",
"ts": 1716825600000,
"data": {},
"utm": {
"source": "google",
"medium": "cpc",
"campaign": "spring-sale"
}
}
]
}'

Note: Authentication is by API key alone — sent as the X-API-Key header, or as apiKey in the body for sendBeacon, which cannot set headers. The key determines which project the events land in, so there is no projectId field to send.

FieldRequiredDescription
apiKeyYour API key — only needed if you cannot send the X-API-Key header
eventsArray of event objects
events[].deviceIdAny stable string identifying the device or process
events[].sessionIdSession identifier. Omit or send "" for backend events — a value here creates a session
events[].eventEvent name — e.g. PAGE_VIEW, CLICK, SERVER_ERROR, or your own
events[].platformweb | ios | android | server. Applied only when this event first creates the device; ignored afterwards
events[].pageCurrent page path
events[].referrerReferring URL
events[].tsUnix timestamp in milliseconds (defaults to server time)
events[].dataAny JSON object with event-specific data
events[].utmObject with source, medium, campaign, term, content

Reporting a backend error by hand

If your language has no Nohmo SDK, post SERVER_ERROR directly. Two fields matter: platform: "server" keeps your app servers out of visitor counts, and an empty sessionId stops every exception creating a one-event session that would drag your average session time to nothing.

bash
curl -X POST https://www.nohmo.in/api/tracker/track/ \
-H "Content-Type: application/json" \
-H "X-API-Key: pk_xxxx" \
-d '{
"events": [
{
"deviceId": "server:web-01:4821",
"sessionId": "",
"event": "SERVER_ERROR",
"platform": "server",
"page": "/api/checkout",
"referrer": "",
"ts": 1716825600000,
"data": {
"message": "ValueError: cart is empty",
"type": "ValueError",
"stack": "Traceback (most recent call last): ...",
"handled": false,
"environment": "production"
}
}
]
}'

For Python and Node you do not need any of this — see Python and Node.js.