Skip to Content

Collect

POST https://api.snowanalytics.app/api/collect

This is the public endpoint the tracking snippet posts to. It’s open (no auth, CORS-enabled) because the browser calls it directly. You rarely need to call it yourself. Prefer the snippet in browsers, and the authenticated Server-side events API on a server. It’s documented here for completeness and custom client integrations.

Request body

Send JSON. Four fields are always required:

FieldTypeNotes
site_idstringYour Site ID.
visitor_idstringUp to 64 chars. May be empty in cookieless mode.
session_idstringUp to 64 chars. May be empty in cookieless mode.
typestringpageview, event, or identify.

Optional context fields (the snippet fills these in automatically):

FieldType
url, pathname, hostname, referrerstring
screen_width, screen_heightnumber
utm_source, utm_medium, utm_campaign, utm_term, utm_contentstring
ref, source, viastring

For type: "event", add:

FieldTypeNotes
event_namestringUp to 128 chars.
event_valuenumber | stringOptional numeric value.
event_propertiesobjectValues may be string, number, boolean, or null.

For type: "identify", add an identity object containing at least user_id (see Identify users).

Example

curl -X POST https://api.snowanalytics.app/api/collect \ -H "Content-Type: application/json" \ -d '{ "site_id": "YOUR_SITE_ID", "visitor_id": "v_abc123", "session_id": "s_def456", "type": "pageview", "url": "https://example.com/pricing", "referrer": "https://www.google.com/" }'

Responses

StatusMeaning
204 No ContentAccepted. (Also returned when a hit is dropped by an exclusion rule; you can’t tell the difference, by design.)
400 Bad RequestMissing or invalid fields.
404 Not FoundNo site matches site_id.
429 Too Many RequestsRate limit exceeded.

Sending events from a server? Use /api/v1/events instead: it’s authenticated, supports idempotency keys, and is built for backend use.