Tracking snippet
Add Orbit analytics to any website with one script tag, and record signups and purchases.
Install
Open Analytics in your dashboard and copy the snippet. It looks like this:
<script defer src="https://YOUR-APP/t.js" data-key="YOUR_WORKSPACE_KEY"></script>Paste it into the <head> of every page you want to measure. Page views appear within seconds.
What it records
- The page path, without the query string
- The referring site, used to group traffic into Organic search, Direct, Referral, Social and Paid
- A random visitor id kept in the browser's local storage, so unique visitors can be counted
It sets no cookies, collects no names or emails, and stops completely when the visitor's browser has Do Not Track switched on. The script is about one kilobyte.
Traffic with utm_medium=cpc, ppc, paid or display is counted as Paid. Links from search engines are Organic search, and well-known social networks are Social.
Single-page apps
The script patches history.pushState, so route changes in React, Vue and similar frameworks are counted as page views automatically.
Count signups and purchases
orbit.track("signup")
orbit.track("purchase", { value: 49 })
orbit.track("clicked_demo")A name other than signup or purchase is recorded as a custom event. A purchase needs a value in your currency units and feeds the revenue numbers.
Record events from your server
If you prefer not to track in the browser, send events with the public API and a write key. This is the more reliable way to count purchases.
The raw endpoint
The script posts to POST /api/events with a JSON body. It is open to every origin on purpose, because the workspace key identifies whose data it is.
| Field | Meaning |
|---|---|
key | Your workspace key (32 characters) |
type | pageview, signup, purchase or custom |
path | The page path |
visitor | A stable anonymous id |
referrer | The referring URL, optional |
value | A number, for purchases only |
Requests are limited per visitor, and each plan has a monthly event allowance. Events over the allowance are refused with HTTP 402.
Sample traffic
The Load sample traffic button adds 90 days of realistic fake events marked as sample data. Clear sample traffic removes only those, never real events.