# What Supametrics collects

> What the tracking script sends, what is stored, the cookies it sets, how visitors, sessions and traffic sources are worked out, and how bots are filtered.

Source: https://supametrics.io/docs/how-tracking-works

This page describes exactly what the Supametrics script (`ax.js`) does in your visitors' browsers and what the
server keeps. Use it to answer privacy questions, fill in your privacy policy and understand why the numbers
look the way they do.

## What the script does

When a page loads, the script:

1. Stops right away if any of these is true: the tag has no `data-site`, the browser was excluded with
   `?ax_ignore=true`, the browser is driven by automation software (`navigator.webdriver`, as in Playwright,
   Puppeteer or Selenium), or the page is on a local host (`localhost`, `127.x.x.x`, `0.0.0.0`, `[::1]`,
   `*.local`, or a `file:` page) without `data-allow-localhost`.
2. With `data-consent="required"`, waits until `analyticsx('consent', true)` is called before doing anything
   else.
3. Reads or creates the visitor and session cookies, sends a pageview, and loads your click goals.

After that it sends:

- A **pageview** on every page load and every single-page-app route change (`history.pushState`,
  `replaceState` and the back and forward buttons). A route change to the same path and query string as the
  current page is not counted again.
- A **click** when a visitor clicks an element that matches one of your [click goals](https://supametrics.io/docs/goals).
- An **event** when your code calls `analyticsx('track', 'name')`.
- An **identify** when your code calls `analyticsx('identify', { ... })`.
- An **exit** when a visitor clicks (or middle-clicks) an `http` or `https` link to another website. Links to
  your own domain and its subdomains are not exits.

Requests go to `https://app.supametrics.io/api/event` (or your `data-api` address) as a small `POST` without
cookies (`credentials: 'omit'`). Clicks, events, identify calls and exits use `sendBeacon` when the browser
supports it, so they arrive even when the click leaves the page.

## What each request contains

| Field | Contents |
|---|---|
| Site ID | Your public site ID from `data-site`. |
| Type | `pageview`, `click`, `event`, `identify` or `exit`. |
| Page URL | The current address, with personal query parameters removed (see below). |
| Referrer | The referring page, on the first pageview of a page load only. |
| Visitor ID and session ID | Random IDs from the cookies described below. |
| Screen size | Screen width and height in pixels. |
| Event ID | A random ID, so a retried request is stored only once. |
| Goal ID | For clicks: which click goal matched. |
| Event name | For `track`: the name, up to 64 characters. |
| Link | For exits: the link's origin and path, without query string, up to 1,000 characters. |
| User ID, email, name | For `identify` only, and only what your code passes (128 characters each, 254 for the email). |

The server also sees the request's `User-Agent` header and IP address, and Cloudflare adds the visitor's
approximate location.

### Personal data removed from URLs

Before anything is sent, the script deletes these query parameters from the page URL (any letter case):
`email`, `e-mail`, `name`, `phone`, `password`, `pass`, `token`, `access_token`, `id_token`, `auth`, `code`,
`secret`, `key`, `api_key`, `license_key` and `license`. A thank-you page at `/welcome?email=ana@example.com`
is sent as `/welcome`.

## What is stored

Supametrics keeps one record per **session** (visit) and one per **pageview** or **goal completion**.

For each session:

- The hostname, the entry page and the exit page.
- The referrer's host and path (without query string), when it is another website.
- The source and channel worked out from it (see [Sources and channels](#sources-and-channels)).
- UTM tags from the landing URL: `utm_source`, `utm_medium`, `utm_campaign`, `utm_term`, `utm_content`, and
  `ref` (or `via`).
- Country, region and city.
- Browser, operating system and device type.
- Screen width and height.
- Pageview and goal counts, start time and last activity.

For each pageview: the time and the page **path**. The query string is not stored; `/pricing?plan=pro` is
recorded as `/pricing`. Paths are stored decoded, without a trailing slash (`/blog/` becomes `/blog`), and up to
500 characters.

Clicks and custom events are stored only when they complete a goal. A custom event name that matches no goal is
remembered by name only, so the **Goals** screen can offer to turn it into a goal.

Exit links are stored as the link's host (without `www.`) and path, plus the page it was clicked on.

Identify calls store the user ID, email (lowercased) and name against the visitor ID. A later call fills in
fields that are missing and never clears earlier ones.

### What is not stored

- **IP addresses.** The IP is used for rate limiting and for your IP [exclusions](https://supametrics.io/docs/exclusions), then
  discarded.
- **Full user agents.** Only the browser name, OS name and device type derived from it.
- **Query strings** of pages and exit links (UTM tags and `ref` are read from the landing URL first).
- **Names, emails or user IDs**, unless you send them with `identify`.
- **Precise location.** Location comes from the network, never from GPS.

## Cookies and browser storage

All cookies are first-party: they are set by the script on your own domain, not on an Supametrics domain.

| Name | Kind | Lifetime | Purpose |
|---|---|---|---|
| `ax_vid` | Cookie | 1 year, renewed on every request | Random visitor ID. |
| `ax_sid` | Cookie | 30 minutes, renewed on every request | Random session ID. |
| `ax_t` | Cookie | Removed immediately | Test cookie used once per page load to find your root domain, just before the visitor cookie is first written (so never before consent). Not set when the tag has `data-domain`. |
| `ax_ignore` | localStorage | Until `?ax_ignore=false` | Marks a browser you excluded with `?ax_ignore=true`. |
| `ax_consent` | localStorage | Until consent is withdrawn | Remembers consent given through `analyticsx('consent', true)`. |
| `ax_goals_<site ID>` | sessionStorage | 1 minute cache, cleared with the tab | Your click goal selectors. |

Cookies use `SameSite=Lax`, `path=/`, and `Secure` on `https` pages. The script tries the shortest domain the
browser accepts a cookie on (for example `example.com` for a page on `app.example.com`), so all your subdomains
share one visitor. If that picks the wrong domain, set it with `data-domain="example.com"`.

With `data-consent="required"`, the script sets no cookie at all, not even the `ax_t` test cookie, until
consent is given. Withdrawing consent (`analyticsx('consent', false)`) deletes the visitor and session cookies.

Sites installed under the old name used `df_vid` and `df_sid`. The script moves them to `ax_vid` and `ax_sid` on
the first visit and deletes the old ones, so returning visitors keep their ID.

Cookieless tracking is not available yet; it shows as **Cookieless / privacy mode** with a **Soon** tag on the
install screen.

## Visitors and sessions

- A **visitor** is one browser on your domain, identified by the `ax_vid` cookie. The same person on another
  device or browser, after clearing cookies, or on a domain that doesn't share the cookie (an additional domain
  rather than a subdomain) counts as a new visitor. Calling `identify` in each browser the person signs in on
  links each of those browsers to them (see [Visitors and visitor profiles](https://supametrics.io/docs/visitors)).
- A **session** (visit) is identified by the `ax_sid` cookie. It ends after 30 minutes without any request from
  that browser; the next pageview starts a new session. There is no cut-off at midnight.
- A session's source, landing page, location and device are decided when it starts. Tagged links opened later in
  the same session don't change its source.

## Sources and channels

Each session gets a **source** and one of seven **channels**: **Direct**, **Organic Search**,
**Organic Social**, **AI**, **Referral**, **Email** and **Paid**.

### Source

1. A tag in the landing URL wins over the referrer: `utm_source`, otherwise `ref` (or `via`).
2. If the tag or the referrer matches a known source, the source is its name (for example `t.co`, `x.com` or
   `?ref=x` all become **X**).
3. Otherwise the source is the tag as written, or else the referrer's domain without `www.`.
4. With neither, the source is **Direct / None**.

Referrers from your own domain, its subdomains and your additional domains are navigation within your site and
are ignored. Links opened from Android apps (`android-app://...`) use the app's package name as the referrer.

Known sources include Google, Bing, DuckDuckGo, Yahoo, Yandex, Baidu, Ecosia and Brave Search (Organic Search);
ChatGPT, Claude, Perplexity, Gemini, Copilot, DeepSeek and Grok (AI); X, YouTube, LinkedIn, Reddit, Facebook,
Instagram, Threads, TikTok, Pinterest, Bluesky, Mastodon and Hacker News (Organic Social); Product Hunt, Medium,
Substack, Dev.to, Indie Hackers and GitHub (Referral); and Gmail, Outlook and `newsletter`, `email` or `mail`
tags (Email). Matching ignores letter case.

### Channel

The first rule that applies decides the channel:

| Rule | Channel |
|---|---|
| `utm_medium` is `cpc`, `ppc`, `cpm`, `paid`, `paid_social`, `paidsearch`, `ad`, `ads`, `display`, `retargeting` or `sponsored` | Paid |
| `utm_medium` is `email`, `e-mail` or `newsletter` | Email |
| The source is a known source | That source's channel |
| `utm_medium` is `social`, `social_media` or `sm` | Organic Social |
| Any other tag or referrer | Referral |
| Nothing | Direct |

Some apps (X, LinkedIn, many email clients) hide the referrer, so their visits arrive as Direct. Tag the links you
share, for example `?utm_source=x&utm_campaign=launch` or `?ref=launch`.

For how sources are used to credit payments, see [Revenue and attribution](https://supametrics.io/docs/revenue).

## Devices, browsers and locations

- **Device** is **Desktop**, **Mobile** or **Tablet**, from the user agent: iPads, tablets and Android devices
  without "Mobile" are tablets; phones are mobile. A "desktop" browser reporting a screen narrower than 600 pixels
  is counted as mobile.
- **Browser** is recognised for the common browsers (Chrome, Safari, Mobile Safari, Firefox, Edge, Opera, Samsung
  Internet, Brave, Arc, Vivaldi, Yandex, DuckDuckGo) and for in-app browsers (Instagram, Facebook, Twitter,
  LinkedIn, Threads, TikTok, Chrome WebView). Anything else is **Other**.
- **Operating system** is iOS, iPadOS, Android, Windows, Chrome OS, Mac OS, Linux or Other.
- **Location** (country, region, city) comes from Cloudflare's lookup of the request's network address. Behind your
  own proxy, see [Serve the script from your domain](https://supametrics.io/docs/install-the-script#serve-the-script-from-your-domain).

## Bots and automated traffic

Bots never count as visitors, pageviews or events:

- The script does nothing in browsers controlled by automation tools (`navigator.webdriver`).
- The server drops requests with no user agent, and user agents of crawlers, link previewers, monitoring and
  testing tools and HTTP libraries: for example Googlebot and other `bot`, `crawl` or `spider` agents, GPTBot,
  ClaudeBot, ChatGPT-User, Perplexity, Bytespider, Ahrefs, Semrush, facebookexternalhit, WhatsApp, Telegram,
  Discord, Lighthouse, Pingdom, uptime monitors, headless browsers, Puppeteer, Playwright, Selenium, curl, wget,
  Python, axios, node-fetch, Go, Java and okhttp clients.

Dropped requests are answered as accepted, so nothing retries them. Crawlers that don't run JavaScript never reach
the script at all; to see them, forward their requests as described in [Bots and AI crawlers](https://supametrics.io/docs/bot-tracking).

## What the server rejects

The event endpoint accepts data only for your site's domain, its subdomains and your additional domains (or any
domain with **Allow all domains** on). Requests from other domains are refused, so nobody can add data to your
stats by copying your snippet. It also refuses malformed requests, bodies over 8 KB and unknown site IDs, and
rate-limits floods from one address. Events matching your [exclusions](https://supametrics.io/docs/exclusions) are accepted but never
stored. The response codes are listed in [Troubleshooting](https://supametrics.io/docs/troubleshooting#check-the-network-request).

## Data retention

Each plan keeps your full-detail history for a set time: 13 months on Starter and 25 months on Growth. Older
data is deleted automatically; see [Automatic deletion of old data](https://supametrics.io/docs/privacy-and-data#automatic-deletion-of-old-data)
and [Plans, billing and event limits](https://supametrics.io/docs/billing). To delete one person's data or a whole website, see
[Privacy and deleting data](https://supametrics.io/docs/privacy-and-data).

## What counts toward your plan

Pageviews, goal completions and payments count as events. Exit-link clicks, custom events and clicks that complete
no goal, identify calls, bots and excluded traffic don't. Details are in
[Plans, billing and event limits](https://supametrics.io/docs/billing).
