New: Free plan is live 7 August 2026 · View changelog →
Antlytics logoAntlytics

Ingest API reference

Prefer the hosted tracker.js or SDK for browser installs. Use these endpoints when you need a custom client, server-side beacon, or debugging.

All three routes accept JSON, share the same ingest guards (rate limits, bot filters, shields), and return 200 { ok: true } even when traffic is silently dropped (no database write).


POST {origin}/api/ingest/pageview

All fields except tracking_id and pathname are optional.

FieldTypeDescription
tracking_idUUID (required)Your site's tracking ID from the dashboard
pathnamestring (required)URL path only, e.g. /blog/my-post (no query string)
referrerstringFull referrer URL
session_idUUIDAnonymous visit id — use a sessionStorage UUID for consistency
user_agentstringUser-Agent string (the server-side request header is preferred; use this only for non-browser SDK contexts)
utm_sourcestringCampaign source
utm_mediumstringCampaign medium
utm_campaignstringCampaign name
utm_termstringPaid search keyword
utm_contentstringDifferentiates creatives or links

Country and device type are always derived server-side from CDN-injected headers (X-Vercel-IP-Country) and the User-Agent request header. These values cannot be overridden from the request body.

The hosted tracker fills UTM fields from the current page URL automatically (sticky for the visit).


POST {origin}/api/ingest/event

Custom events from Antlytics.track(name, props). See Custom events.

FieldTypeDescription
tracking_idUUID (required)Site tracking ID
event_namestring (required)Event name (letters, numbers, spaces, . : / _ -)
pathnamestring (required)Path where the event fired
referrerstringOptional referrer
session_idUUIDOptional visit id
propsobjectOptional scalar props only (string / number / boolean / null); max 20 keys, ~1 KB JSON

POST {origin}/api/ingest/engagement

Engagement beacon (scroll depth + active time) sent on page hide / unload by the hosted tracker.

The hosted tracker.js sends this via navigator.sendBeacon with a JSON body and Content-Type: text/plain (CORS-safelisted, avoids a preflight). A keepalive fetch with application/json is the fallback. The server parses JSON from the body either way.

Browser CORS responses echo the request Origin and allow credentials so sendBeacon succeeds cross-origin (for example WordPress → www.antlytics.com).

FieldTypeDescription
tracking_idUUID (required)Site tracking ID
pathnamestring (required)Path being measured
session_idUUIDOptional visit id
scroll_depthinteger 0–100Max scroll percentage
duration_msintegerActive time on page (capped server-side)

At least one of scroll_depth or duration_ms must be present or the request is accepted with no write.


Rate limits

Ingest enforces sliding-window rate limits per IP address and per tracking ID. Requests that exceed the limit receive 429 Too Many Requests with a Retry-After header.

Bot and spam filtering

Ingest silently accepts (HTTP 200) but does not record traffic that matches known bot user-agents, spam referrers, datacenter / cloud hosting client IPs, shield rules, or suspicious header patterns. See Bot filtering.

A valid site server secret in the Authorization header bypasses hostname policy and the datacenter / suspicious-header layers (trusted server callers often run in cloud). UA and spam-referrer filters and IP shields still apply.

Something missing? Get in touch and we will update these docs.