Measuring
Custom events
Anything beyond a pageview: signups, purchases, downloads, form submissions. Send them from the browser, from your backend, or both.
Send an event with a new name and it appears in your dashboard the first time it fires. You never pre-register event names.
From the browser
The tracking script exposes window.thunderstats.track:
thunderstats.track('signup')
// with properties
thunderstats.track('signup', { plan: 'pro', source: 'landing' })
// with properties and revenue
thunderstats.track('purchase', { plan: 'pro' }, 29.00)
Wire it to anything:
<button onclick="thunderstats.track('cta_click', { location: 'hero' })">
Sign up
</button>
The call is a no-op if the script has not loaded (blocked, still loading, offline), so analytics can never break your page.
From your server
Send the same events from a backend with no browser involved — useful for things the browser cannot confirm: a payment that actually cleared, a subscription renewal, a signup that passed verification.
curl -X POST https://api.thunderstats.com/api/collect/event \\
-H "Authorization: Bearer ts_your_api_key" \\
-H "Content-Type: application/json" \\
-d '{
"name": "purchase",
"url": "https://yoursite.com/checkout/thanks",
"props": { "plan": "pro" },
"revenue": 29.00,
"ip": "203.0.113.10",
"ua": "Mozilla/5.0 ..."
}'
Browser events and server events with the same name are the same event in your dashboard. Full parameters, authentication and limits are in the HTTP API reference.
They are what tie a server-sent event to the visit. Send the same ip and ua the visitor's pageview carried and the event joins that session, so it counts in funnels and shows on the visitor timeline. Omit them and the event still counts, but lands in a session of its own. Neither value is stored.
Limits and rules
| Field | Rule |
|---|---|
name | Up to 128 characters, any string. Names beginning with _ are reserved for internal use and are hidden from the events list. |
props | Up to 20 keys. Values must be a string or a number; string values up to 256 characters. |
revenue | Any finite number, stored as-is. Use one currency consistently — ThunderStats does not convert. |
Reading events back
The Events page lists every event name with its count, unique visitors and total revenue. Expand a row for:
- Recent events — individual occurrences with their properties, page, and a link to the visitor timeline that fired them.
- Property breakdown — counts grouped by the value of one property, with the keys that event actually carries offered as a pick list.
The same data is available over HTTP — see reading your data.
Next: Goals & funnels →