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.
| Field | Required | Description |
|---|---|---|
| apiKey | — | Your API key — only needed if you cannot send the X-API-Key header |
| events | ✓ | Array of event objects |
| events[].deviceId | ✓ | Any stable string identifying the device or process |
| events[].sessionId | — | Session identifier. Omit or send "" for backend events — a value here creates a session |
| events[].event | ✓ | Event name — e.g. PAGE_VIEW, CLICK, SERVER_ERROR, or your own |
| events[].platform | — | web | ios | android | server. Applied only when this event first creates the device; ignored afterwards |
| events[].page | — | Current page path |
| events[].referrer | — | Referring URL |
| events[].ts | — | Unix timestamp in milliseconds (defaults to server time) |
| events[].data | — | Any JSON object with event-specific data |
| events[].utm | — | Object 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.