> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crispstats.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> CrispStats is a hosted, privacy-first web analytics product. It has no self-hosted edition, no session replay, no heatmaps, no A/B testing, no mobile SDKs and no data import except a site's history from a Plausible export (Settings, Import and export).
> The script global is crispstats(...), site keys start with cs_pk_ and secret API keys start with cs_sk_. The script is served from https://in.crispstats.com/d.js and the REST API lives at https://crispstats.com/api/v1.
> There is no npm package to install. Integrations copy the script tag, the queue stub, crispstats.d.ts and proxy code from these docs or from Settings, Tracking code in the dashboard. A first-party proxy forwards one path of the site to https://in.crispstats.com/p/ and forwards only content-type, user-agent, accept-language, referer, origin, if-none-match and x-forwarded-for, never cookies.

# Metrics and traffic channels explained

> How CrispStats calculates visitors, sessions, bounce rate, visit duration, conversion rate and revenue per visitor, and how it sorts traffic into channels.

CrispStats reports nine headline metrics: visitors, sessions, pageviews, views per visit, bounce rate, visit duration, revenue, conversion rate and revenue per visitor. Each one is calculated the same way in the dashboard, the [REST API](https://docs.crispstats.com/api-reference/introduction.md), the [MCP server](https://docs.crispstats.com/api-reference/mcp.md) and Ask AI. This page gives the exact definition of each metric, what the columns in breakdown tables mean, and the rules that sort every visit into a traffic channel such as organic search, social or AI assistants.

## Headline metrics

The overview shows six of these metrics as tiles above the chart: **Visitors**, **Revenue**, **Conversion rate**, **Revenue per visitor**, **Bounce rate** and **Visit duration**. A [public dashboard](https://docs.crispstats.com/share/public-dashboard.md) with revenue hidden shows **Visitors**, **Sessions**, **Pageviews**, **Views per visit**, **Bounce rate** and **Visit duration** instead. The API's `GET /sites/{siteId}/stats` returns all nine.

| Metric | API field | Definition |
| - | - | - |
| Visitors | `visitors` | Unique visitor ids in the period. See [counting visitors](#counting-visitors). |
| Sessions | `sessions` | Visits that started in the period. |
| Pageviews | `pageviews` | Pageviews in the period. |
| Views per visit | `viewsPerVisit` | Pageviews divided by sessions. |
| Bounce rate | `bounceRate` | Bounced sessions divided by sessions. |
| Visit duration | `avgDuration` | Total session duration divided by sessions, in seconds. |
| Revenue | `revenue` | Sum of payments in the period, refunds excluded. |
| Conversion rate | `conversionRate` | First payments divided by visitors, at most 100%. |
| Revenue per visitor | `revenuePerVisitor` | Revenue divided by visitors. |

In the `stats` response, each metric sits in the `metrics` object with its `value`, its `previous` value and its `change` (the last two are `null` when comparison is off). In API responses, money is an integer in minor units (cents) of the site's currency, rates are numbers from 0 to 1, and durations are seconds. A ratio whose denominator is zero is reported as 0.

### Counting visitors

A visitor is an anonymous id. In the default privacy mode the id rotates at the start of each day in the site's timezone, the same days your reports use, so one browser is one visitor per day. Over a longer period, visitors are the sum of each day's unique visitors: someone who visits on three different days counts as three visitors in a 30-day report. With [persistent visitors](https://docs.crispstats.com/privacy/persistent-visitors.md) turned on, the id lasts across days and a period total counts each id once.

On the chart, visitors are unique within each bucket. The same visitor in two hourly buckets is counted in both, so adding up the points of an hourly chart gives a larger number than the period total. Use the tile, or the API's `stats` endpoint, for the total. [How CrispStats works](https://docs.crispstats.com/concepts/how-crispstats-works.md#visitors) explains how the id is made.

### Sessions and pageviews

A session ends after 30 minutes without an event, or when the visitor comes back through a different referrer or campaign. See [sessions](https://docs.crispstats.com/concepts/how-crispstats-works.md#sessions) for the full rule.

The script records a pageview on page load, on each single-page navigation through the History API, and on `hashchange` when the script has `data-hash`. The same URL twice in a row counts once. A page restored from the browser's back/forward cache counts as a new pageview.

### Bounce rate

A session bounces when it has at most one pageview and no custom events. Custom events include the ones the optional modules send (`Outbound link`, `File download` and `404`), so a visitor who views one page and clicks an outbound link does not bounce. Engagement pings, web vitals, JavaScript errors, identify calls and `crispstats.revenue()` events do not count as interaction.

### Visit duration

A session's duration is the time from its first event to its last event or engagement ping. The script sends a ping when the page is hidden or left, and before each single-page navigation, so a visit to a single page still gets a duration when the visitor leaves. Visit duration is the average over all sessions, bounced ones included.

### Revenue, conversions and revenue per visitor

Revenue comes from payments: payments read from the providers you connect with a key ([Stripe](https://docs.crispstats.com/revenue/stripe.md), [Polar](https://docs.crispstats.com/revenue/polar.md), [Paddle](https://docs.crispstats.com/revenue/paddle.md), [Dodo Payments](https://docs.crispstats.com/revenue/dodo.md), [Creem](https://docs.crispstats.com/revenue/creem.md), [Whop](https://docs.crispstats.com/revenue/whop.md), [Razorpay](https://docs.crispstats.com/revenue/razorpay.md), [Lemon Squeezy](https://docs.crispstats.com/revenue/lemon-squeezy.md), [Shopify](https://docs.crispstats.com/revenue/shopify.md), [RevenueCat](https://docs.crispstats.com/revenue/revenuecat.md), [Superwall](https://docs.crispstats.com/revenue/superwall.md), [App Store](https://docs.crispstats.com/revenue/app-store.md) and [Shopify App Store](https://docs.crispstats.com/revenue/shopify-app-store.md)), and revenue sent with `crispstats.revenue()` or the [payment API](https://docs.crispstats.com/revenue/payment-api.md). Test-mode payments are kept out of revenue.

* **Revenue** is the gross sum of payments whose payment time falls in the period. Refunds are left out of this figure and reported separately on the [revenue](https://docs.crispstats.com/revenue/overview.md) screen.
* **A conversion** is a customer's first payment, refunds aside, and it counts only when that payment is a one-time purchase or a new subscription. A later payment from the same customer never counts, even when their first payment is outside the period, so renewals are never conversions. Customers are recognised by their hashed email address, then by user id, then by visitor id.
* **Conversion rate** is conversions divided by visitors, capped at 100%.
* **Revenue per visitor** is revenue divided by visitors.

## Breakdown tables

Each row in a breakdown, such as a source, a page or a country, has its own set of numbers. The details view of a card and the API's `GET /sites/{siteId}/breakdown/{dimension}` return them.

| Column | API field | Meaning |
| - | - | - |
| Visitors | `visitors` | Unique visitors with this value. |
| Pageviews | `pageviews` | Pageviews with this value. |
| Sessions | `sessions` | Sessions with this value. For pages and events: sessions that viewed the page or sent the event. |
| Bounce rate | `bounceRate` | Bounced sessions divided by sessions. For pages: the bounce rate of sessions that entered on the page. |
| Visit duration | `avgDuration` | Average session duration in seconds. For pages: average time on page. |
| Revenue | `revenue` | Gross revenue credited to this value. |
| Conversions | `conversions` | First payments credited to this value. |
| Conversion rate | `conversionRate` | Conversions divided by visitors, at most 100%. |
| Share | `share` | This row's visitors divided by the sum of visitors over all rows of the breakdown, from 0 to 1. |
| Change | `change` | Change in visitors against the comparison period, as a ratio (`0.12` is +12%). `null` when comparison is off or the row had no visitors in the comparison period. |

Revenue and conversions in a breakdown are credited by first touch: to the source, channel, campaign and landing page of the customer's first visit. Location, browser, operating system and device come from the visit that paid, or from the customer's last visit before the payment. Rows for page, exit page, event, hostname, UTM term, UTM content and language show no revenue, because payments do not carry those values.

When you turn on comparison, every metric also gets the value for the previous period of the same length, or for the same dates a year earlier. See [filters and comparison](https://docs.crispstats.com/dashboard/filters-and-comparison.md).

## Traffic channels

CrispStats sorts every session into one channel, using the referrer and the UTM tags of the session's first pageview. The rules run in this order, and the first match wins:

| Order | Channel | Rule |
| - | - | - |
| 1 | Paid | `utm_medium` is `cpc`, `ppc`, `paid`, `paidsearch`, `paid-search`, `paid_social`, `paidsocial`, `cpm`, `cpv`, `cpa`, `retargeting`, `ad` or `ads`, or the landing URL has an ad click id: `gclid`, `gbraid`, `wbraid`, `msclkid`, `fbclid`, `ttclid`, `twclid` or `li_fat_id`. |
| 2 | Email | `utm_medium` is `email`, `e-mail`, `newsletter` or `mail`. |
| 3 | Affiliate | `utm_medium` is `affiliate`, `affiliates`, `partner` or `referral-program`. |
| 4 | Display | `utm_medium` is `display`, `banner` or `interstitial`. |
| 5 | AI assistants | The referrer is an [AI assistant](#ai-assistants), or `utm_source` names one. |
| 6 | Organic search | The referrer is a search engine: Google, Bing, DuckDuckGo, Yahoo, Yandex, Baidu, Ecosia, Brave Search, Startpage, Qwant, Naver or Seznam. |
| 7 | Social | The referrer is a social network or community: X, Facebook, Instagram, LinkedIn, Reddit, Hacker News, Product Hunt, Threads, Bluesky, Mastodon (`mastodon.social`), TikTok, Pinterest, Indie Hackers, DEV, Medium, Discord, Telegram, WhatsApp, GitHub, Substack or Lobsters. |
| 8 | Video | The referrer is YouTube, Vimeo or Twitch. |
| 9 | Referral | Any other referrer, or a `utm_source` without a referrer. |
| 10 | Direct | No referrer and no `utm_source`. |

`utm_medium` matching ignores case. A few details decide edge cases:

* **Your own hostname counts as direct.** A referrer on the page's own hostname or one of its subdomains is ignored (a leading `www.` does not matter), so navigation within one hostname is never a referral. The match only works downward: a link from `blog.example.com` to a page on `example.com` is direct, but a link from `example.com` to a page on `blog.example.com` is a referral from `example.com`.
* **`utm_source` has shorthands.** When `utm_source` is missing, CrispStats reads `ref`, then `source`, then `via` from the landing URL. A link like `https://example.com/?ref=newsletter` gets the source `newsletter`.
* **Hostnames match subdomains.** `news.ycombinator.com` and `www.reddit.com` match their entries, and `google.` matches every Google country domain, such as `google.co.uk`.

### Source names

Next to the channel, each session gets a source name, shown in the **Source** tab of the Sources card. It is the friendly name when the referrer is a known AI assistant, search engine, social network or video site (`Google`, `ChatGPT`, `Hacker News`). Otherwise it is the `utm_source` value, then the referrer hostname without `www.`, then `Direct`. The **Referrer** tab shows the referrer hostname itself, and the **Campaign** tab shows `utm_campaign`.

### AI assistants

A visit is in the AI assistants channel when a person follows a link from one of these assistants. The **AI** tab of the Sources card and the [AI traffic](https://docs.crispstats.com/ai/ai-traffic.md) screen list them by name.

| Assistant | Referrer hostnames |
| - | - |
| ChatGPT | `chatgpt.com`, `chat.openai.com`, `openai.com` |
| Perplexity | `perplexity.ai` |
| Claude | `claude.ai` |
| Gemini | `gemini.google.com`, `bard.google.com` |
| Copilot | `copilot.microsoft.com`, `copilot.com` |
| You.com | `you.com` |
| Phind | `phind.com` |
| Poe | `poe.com` |
| Meta AI | `meta.ai` |
| Grok | `grok.com`, `x.ai` |
| Le Chat | `chat.mistral.ai` |
| DeepSeek | `chat.deepseek.com` |
| Kagi Assistant | `kagi.com` |
| Duck.ai | `duck.ai` |
| T3 Chat | `t3.chat` |

Some assistants send no referrer but add a UTM tag instead. A visit also counts as AI traffic when `utm_source` is one of the hostnames above, such as `chatgpt.com`, or becomes one when `.com` is added, such as `chatgpt` or `copilot`.

These are people who clicked a link. AI crawlers that fetch your pages for training or search are not visitors and never appear in these numbers. CrispStats counts them separately: see [AI crawlers](https://docs.crispstats.com/ai/ai-crawlers.md).

### Try the rules

Enter a referrer and a landing URL to see the channel and source CrispStats would record. The widget runs the same rules as the collector, and treats the landing URL's hostname as your own.

Referrer

Landing page URL

Channel

Source

Referrer

## Learn more on crispstats.com

* Glossary: [pageview](https://crispstats.com/glossary/pageview), [unique visitor](https://crispstats.com/glossary/unique-visitor), [session](https://crispstats.com/glossary/session), [bounce rate](https://crispstats.com/glossary/bounce-rate), [engagement rate](https://crispstats.com/glossary/engagement-rate), [traffic channel](https://crispstats.com/glossary/traffic-channel) and [UTM parameters](https://crispstats.com/glossary/utm-parameters).
* Free tools: the [traffic source classifier](https://crispstats.com/tools/traffic-source-classifier) runs the channel rules on this page on any referrer or URL, and the [UTM builder](https://crispstats.com/tools/utm-builder) shows which channel a tagged link lands in.

## Next steps

> [card] [How CrispStats works](https://docs.crispstats.com/concepts/how-crispstats-works.md)
>
> The path of an event, and when it shows up in your reports.

> [card] [Read the overview](https://docs.crispstats.com/dashboard/overview.md)
>
> Where each metric and breakdown lives in the dashboard.

> [card] [AI traffic](https://docs.crispstats.com/ai/ai-traffic.md)
>
> Visitors, revenue and landing pages from AI assistants.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.