Skip to content

API

Collect & read API

Send events directly to the collect endpoint and read statistics with an API key.

Collect endpoint

The script and all SDKs send data to POST /api/collect (alias /api/v1/collect). No authentication is needed — the website ID is the public identifier. Web requests must come from the registered domain or a subdomain.

POST https://trackd.one/api/collect
Content-Type: application/json

{ "type": "pageview", "website_id": "YOUR_WEBSITE_ID", "url": "https://example.com/pricing" }

No SDK for your platform? Send events directly, e.g. from a server, a CLI or a game engine:

curl -X POST https://trackd.one/api/collect   -H "Content-Type: application/json"   -d '{
    "website_id": "YOUR_WEBSITE_ID",
    "context": { "platform": "server", "app_version": "1.0.0" },
    "events": [
      { "type": "screen_view", "name": "Home" },
      { "type": "event", "event_name": "signup", "event_data": { "plan": "pro" } }
    ]
  }'

Batches

Apps should send batches (max. 50 events per request). The context fields are merged into every event:

{
  "website_id": "YOUR_WEBSITE_ID",
  "context": { "platform": "android", "app_version": "2.3.1", "os_version": "Android 15" },
  "events": [
    { "type": "screen_view", "name": "Home" },
    { "type": "event", "event_name": "signup", "event_data": { "plan": "pro" } }
  ]
}

Fields

Field Types Notes
type all pageview, event, screen_view, app_event, vitals, heatmap
website_id all UUID, required (per event or in the batch)
url pageview, event full URL (web), required for pageview
name screen_view screen name, e.g. Home (stored as path /Home)
event_name event required, max. 200 characters
event_data event flat JSON object, max. 4 KB
platform, app_version, os_version all e.g. android, 2.3.1, Android 15
session_id all optional, ephemeral and in memory only, 8–64 characters; never persist it
timestamp all optional (ms or ISO) for queued events; events older than 72 h are dropped

Responses

  • 202 { "ok": true, "accepted": 3, "rejected": 0 }
  • 400 invalid JSON / no valid event, 404 unknown website, 403 origin mismatch (web only), 413 body larger than 64 KB
  • 429 rate limit or monthly event limit reached (see the Retry-After header)

Rate limits: 3000 requests/minute per IP and 600 requests/minute per visitor and website (web: IP + website; apps without Origin: session + website). From browsers send the body as text/plain (no CORS preflight); it is parsed as JSON.

Events from localhost, 127.0.0.1, ::1, *.local and *.localhost are not counted — unless the project’s domain itself is such an address.

Proxy

Your own server may forward events on behalf of visitors, e.g. the WordPress plugin in proxy mode. So that trackd.one uses the visitor’s IP address and country instead of the server’s, the proxy also sends these headers:

Header Meaning
X-Trackd-Proxy-Key the website’s proxy key (tpk_…, created under Settings → Install → WordPress; owners and admins)
X-Trackd-Client-IP the visitor’s IP address (IPv4 or IPv6); only used for the daily rotating visitor hash, never stored
X-Trackd-Client-Country optional: the visitor’s country as a two-letter ISO code (e.g. AT). Without it the country stays unknown
Origin, User-Agent, Accept-Language the visitor’s / website’s values (the domain check still applies)

Without X-Trackd-Proxy-Key, the X-Trackd-Client-* headers are ignored. An invalid, revoked or foreign key returns 403. A missing or invalid X-Trackd-Client-IP returns 400. The 3000 requests/minute rate limit applies per key and visitor IP, not to the whole server. Up to 5 keys per website. The key is secret: it belongs on the server only, never in the browser.

Data export

In a project’s analytics view the export button (owners and admins) downloads raw data as CSV or JSON: GET /api/websites/:id/export?format=csv|json&type=…&from&to.

type Content
pageviews (default) pageviews and screen views
events custom events incl. event_name, properties (JSON) and revenue (amount, currency)
sessions sessions
vitals Web Vitals measurements

At most 100,000 rows are returned per request. If the result was truncated, the response carries the header X-Export-Truncated: 1 — pick a shorter date range.

API keys

Access your statistics programmatically. Create a key under Account → API keys (user menu, bottom left) (Pro and above). The key is shown only once — copy it right away.

Read API (v1)

Send the key as a bearer token. from/to are ISO timestamps (default: last 7 days).

curl "https://trackd.one/api/v1/websites/YOUR_WEBSITE_ID/stats?from=2026-01-01T00:00:00Z"   -H "Authorization: Bearer tp_xxxxxxxx"
Method Path Result
GET /api/v1/websites all projects
GET /api/v1/websites/:id/stats?from&to key figures
GET /api/v1/websites/:id/timeseries?from&to&interval=day|hour&tz=Europe/Berlin time series
GET /api/v1/websites/:id/top/:field?from&to&limit top list
GET /api/v1/websites/:id/events?from&to events
GET /api/v1/websites/:id/shop?from&to shop KPIs, funnel, products
GET /api/v1/websites/:id/orders?from&to&status&limit&offset orders with lines
PATCH /api/v1/websites/:id/orders/:orderId change payment status / refund (see below)
GET /api/v1/websites/:id/realtime active visitors and pages

Allowed values for :field: pathname, referrer, country, browser, os, device, language, hostname, utm_source, utm_medium, utm_campaign, utm_term, utm_content, platform, app_version, os_version.

Orders

For shop backends: report payments (prepayment, bank transfer), cancellations and refunds. This needs an API key with the option “May change order status”; the key owner must be owner or admin of the website.

curl -X PATCH "https://trackd.one/api/v1/websites/YOUR_WEBSITE_ID/orders/10042" \
  -H "Authorization: Bearer tp_xxxxxxxx" -H "Content-Type: application/json" \
  -d '{"status":"paid"}'

# partial refund of 15.90 (deducted from revenue)
  -d '{"refunded_amount":15.9}'

status: paid, pending or cancelled; refunded_amount: 0 up to the order amount. Response: { order_id, amount, status, refunded_amount }, unknown order id → 404. More on shops: revenue tracking.

Filters

All analytics endpoints accept filters as filter_<field>=<value> (exact match, combinable), e.g. ?filter_platform=android&filter_app_version=2.3.1.

Ready in minutes

Start the 7-day free trial (no credit card), add your website or app, copy the snippet.

Start free trial