Collect
POST https://api.snowanalytics.app/api/collectThis 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:
| Field | Type | Notes |
|---|---|---|
site_id | string | Your Site ID. |
visitor_id | string | Up to 64 chars. May be empty in cookieless mode. |
session_id | string | Up to 64 chars. May be empty in cookieless mode. |
type | string | pageview, event, or identify. |
Optional context fields (the snippet fills these in automatically):
| Field | Type |
|---|---|
url, pathname, hostname, referrer | string |
screen_width, screen_height | number |
utm_source, utm_medium, utm_campaign, utm_term, utm_content | string |
ref, source, via | string |
For type: "event", add:
| Field | Type | Notes |
|---|---|---|
event_name | string | Up to 128 chars. |
event_value | number | string | Optional numeric value. |
event_properties | object | Values 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
| Status | Meaning |
|---|---|
204 No Content | Accepted. (Also returned when a hit is dropped by an exclusion rule; you can’t tell the difference, by design.) |
400 Bad Request | Missing or invalid fields. |
404 Not Found | No site matches site_id. |
429 Too Many Requests | Rate limit exceeded. |
Sending events from a server? Use /api/v1/events instead:
it’s authenticated, supports idempotency keys, and is built for backend use.