Start free

Server-side events API

Send pageviews and events from your server or app backend: pages without JavaScript, APIs, feeds and background jobs.

Integrations, API & AIFeature page: Server-side events API: count what a browser script can’t see
API keys section in SettingsAPI keys section in Settings
A real quietstats screen, taken with a throwaway test account that was deleted afterwards.

What it does

POST /api/v1/events with a “Send events” key that belongs to one site. Each request carries one event or up to 20, each with the page address and, for a custom event, its name and a short property. They appear in the same dashboard, goals and funnels as browser hits.

Why it matters

Some things never run a browser script: an API call, an RSS feed, a server-rendered page for visitors who block scripts, an order confirmed in a background job. The API counts them with the same privacy rules as the tracker.

How to use it

  1. In Settings → API keys, choose “Send events only”, pick the site and create the key. Keep it on your server.
  2. POST JSON to /api/v1/events with Authorization: Bearer and your key: {"url": "/pricing"} for a pageview, or add "name" and "prop" for an event. Send {"events": [...]} for up to 20 at once.
  3. To join the visitor’s browser visit, add their "ip" and "user_agent"; neither is stored. Read the reply: each event is counted, dropped (bot, dnt, over_limit) or rejected with a message.
Shell
curl -X POST https://quietstats.co.uk/api/v1/events \
  -H "Authorization: Bearer qs_…" -H "Content-Type: application/json" \
  -d '{"url": "/api/orders", "name": "Order placed", "prop": "plan: large"}'

Replace YOUR_SITE_ID with the ID shown on your site’s Manage page.

How it works

How a server-side event is counted1. Your server POSTs to /api/v1/events with a “Send events” key for one site: one event or up to 20. 2. Each url must be on that site (or a path). No name = pageview; a name = custom event with an optional short prop. 3. Dropped: bots (by user agent), dnt or gpc true, personal data in names or props, other domains. (otherwise: The reply says why, per event) 4. Visitor: the tracker’s own daily hash from ip + user agent, or a daily hash of your visitor_key, or one server visitor a day. 5. Stored: path, utm tags, referrer host, country, device, browser, OS. Never the IP, user agent or key. 6. Counted in the same dashboard, goals and funnels as browser hits; pageviews count towards your plan.1Your server POSTs to/api/v1/events with a “Sendevents” key for one site: oneevent or up to 20.2Each url must be on that site(or a path). No name =pageview; a name = customevent with an optional shortprop.3Dropped: bots (by user agent),dnt or gpc true, personal datain names or props, otherdomains.The reply sayswhy, per event4Visitor: the tracker’s owndaily hash from ip + useragent, or a daily hash of yourvisitor_key, or one servervisitor a day.5Stored: path, utm tags,referrer host, country,device, browser, OS. Never theIP, user agent or key.6Counted in the same dashboard,goals and funnels as browserhits; pageviews count towardsyour plan.
From the serverevents.js and collector code. 1 row per counted event.

Privacy

Limits

Plans

Every plan, including Free. quietstats is free during launch: the Free plan covers 1 site and 5,000 pageviews a month, and no card is needed. See pricing.

Questions

Is it the same key as the Stats API?

No. A “Send events” key can only send, and a read key can only read.

Can I backfill old data?

No. Events are counted at the time you send them. Use the import tool for history.

Will my server’s address show up as a visitor?

Only if you pass your server’s own ip and user agent. Pass the visitor’s, or a visitor_key, or nothing.

Related