Skip to content

Realtime API

Read who is on the site right now: a per-minute series for the last 30 minutes and a row for each live visitor.

GET /sites/:site/realtime answers one question: who is here now. It always reads raw events for the last 30 minutes, so it ignores from, to and tz entirely.

bash
curl -H "Authorization: Bearer sta_your_token" \
  "https://statsy.co/api/v1/sites/ws_yoursitekey/realtime"

Parameters

ParameterNotes
filtersThe same JSON filter array as everywhere else.
limitVisitor rows to return. Defaults to 200, maximum 1000.

What you get back

data.series is one entry per minute for the last 30 minutes, each {minute, visitors}, which is what draws the live chart. data.visitors is a row per visitor with their id, country, region, city, approximate coordinates, current path, referrer, channel, device, browser, operating system, purchase-intent score and when they were last seen.

Cookieless visitors have an identifier of the form anon_<hash>. It groups that visitor’s events within the day and cannot be traced back to a person or linked across days. See Tracking modes.

Polling

There is no streaming endpoint; poll instead. Once every five seconds is a good rhythm and is what statsy visitors --live uses. Stay inside the 60 requests a minute limit, and back off when you see a 429 with Retry-After.

Note. The window is fixed at 30 minutes. If realtime shows nobody while your daily numbers look fine, nothing is broken — nobody has been on the site in the last half hour. Script installed but no data covers the case where nothing arrives at all.

The same window elsewhere

The now preset on overview, timeseries and breakdown means the same last 30 minutes, which is useful when you want realtime numbers shaped like the rest of your reporting. Those requests are served from raw events and default to hourly buckets.

Last updated · Markdown version