> ## 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.

# Traffic figure widgets: visitors, pageviews and AI visitors

> Show visitors, pageviews, sessions or visitors from AI assistants over a range, with the change and a chart, as a pill, a card, a goal bar or a README badge.

A traffic figure widget shows one number from your dashboard over a range you choose: visitors in the last 30 days, pageviews this year, or the visitors that AI assistants sent you. The card adds the change against the period before and a chart of the same period. The numbers are the ones on your [Overview](https://docs.crispstats.com/dashboard/overview.md), counted the same way.

![A card headed Visitors showing 72,082, up 23% against the previous 30 days, with a 30-day chart](https://mintcdn.com/crispstats/E7Fpqdyq9pa1UkLm/images/widgets/style-soft-light.png?fit=max\&auto=format\&n=E7Fpqdyq9pa1UkLm\&q=85\&s=f350ac232a48b15c09dfdbdbce8842b1)

Visitors card

![A card headed Visitors from AI assistants showing 4,940, up 20%, with the footer Mostly from ChatGPT and Perplexity](https://mintcdn.com/crispstats/E7Fpqdyq9pa1UkLm/images/widgets/ai-card-light.png?fit=max\&auto=format\&n=E7Fpqdyq9pa1UkLm\&q=85\&s=022516e72e7a3eb29357610270f00681)

AI assistants card

![A pill reading 72.1k visitors in the last 30 days, and the CrispStats mark](https://mintcdn.com/crispstats/E7Fpqdyq9pa1UkLm/images/widgets/stat-pill-light.png?fit=max\&auto=format\&n=E7Fpqdyq9pa1UkLm\&q=85\&s=7854150054b02e942583645491c92eb2)

Stat pill

![A goal headed Road to 100,000 visitors with the bar at 72%](https://mintcdn.com/crispstats/E7Fpqdyq9pa1UkLm/images/widgets/growth-goal-light.png?fit=max\&auto=format\&n=E7Fpqdyq9pa1UkLm\&q=85\&s=41dfa11056fce4845a3fa71c86274432)

Growth goal

## What it counts

| Metric | Counts | Card heading |
| - | - | - |
| Visitors | Unique visitors in the range | Visitors |
| Pageviews | Pages viewed in the range | Pageviews |
| Sessions | Visits in the range | Sessions |
| Visitors from AI assistants | Visitors who arrived from an assistant such as ChatGPT, Perplexity or Claude | Visitors from AI assistants |

**Range** is the last 24 hours, 7 days, 30 days, 90 days or 12 months, or all time. The pill says it in words, such as `in the last 30 days` or `all time`, and shortens it to `in 30 days` when the sentence does not fit the size. The definitions of each metric are in [Metrics](https://docs.crispstats.com/concepts/metrics.md).

## Layouts

| Layout | What it shows |
| - | - |
| Pill | One sentence with a short figure: `48.2k visitors in the last 30 days`, or `48.2k visitors in 30 days` at size Small. |
| Card | The heading, the full figure (`48,213`), the change, a chart and the footer `Last 30 days · updated 2 min ago`. |
| Goal | `Road to 10,000 visitors`, a bar and the share reached (`63%`). At or past the goal it says `Goal reached` with a full bar. |
| Badge | An image with `visitors 30d` on the left and `48.2k` on the right. |

**Change** compares with the period of the same length just before, such as `+18% vs previous 30 days`, with an arrow up or down. All time has no period before it, so it shows no change. **Sparkline** draws the range in up to 31 points: hours for 24 hours, days for 7 and 30 days, weeks for 90 days and months for 12 months or all time.

The AI assistants card names the two assistants that sent the most visitors, as `Mostly from ChatGPT and Perplexity`, when each sent at least 3. Otherwise the line is left out.

**Goal** is a whole number of the metric, set in the widget. The goal is your own choice and is public: only the share reached comes from your data.

A figure of 0 hides the widget instead of showing an empty number.

## Numbers in your language

Figures and dates are in English by default, to match the words, which are English in this version. To format them for another language, set `lang` on the element: `lang="de"` shows `48.213`. The page's own `lang` is not used, so a widget never mixes German numbers into English words by accident.

## How fresh it is

The script fetches the figure when the widget scrolls into view and again every 10 minutes while the tab is visible. CrispStats recomputes it at most every 300 seconds, so a figure can be a few minutes behind the dashboard. The footer says how old it is: `updated 2 min ago`. If CrispStats cannot reach your data for a while, the widget keeps its last figure for up to 6 hours and the footer says `as of 14:05` instead; after that it hides.

## Add it

1. Open **Settings**, **Sharing and widgets** and pick **Visitors card**, **Stat pill**, **Growth goal**, **AI assistants card** or, for a README, **README badge**.
2. Choose the metric, the range and the goal if there is one, then select **Create widget**.
3. Copy the code. For a card on your site:

```html wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
<script async src="https://in.crispstats.com/w/v1/loader.js"></script>
<crispstats-widget widget="cs_wd_7Hq2Lx9PzK4mVt8RbN3cW1yD" style="display:inline-block;vertical-align:middle;width:320px;height:176px"></crispstats-widget>
```

For a README, the **README** tab gives an image that follows GitHub's light and dark theme:

```html wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
<a href="https://crispstats.com/share/quillbook"><picture><source media="(prefers-color-scheme: dark)"><img alt="Visitors on quillbook.com" src="https://in.crispstats.com/w/v1/i/cs_wd_7Hq2Lx9PzK4mVt8RbN3cW1yD.svg?theme=light" height="20"></picture></a>
```

Your own code carries your widget's token instead of `cs_wd_7Hq2Lx9PzK4mVt8RbN3cW1yD`. Other forms are on [Embed a widget](https://docs.crispstats.com/share/widgets/embed.md).

## Next steps

> [card] [Revenue and sales](https://docs.crispstats.com/share/widgets/revenue.md)
>
> Verified MRR and sales from your payment provider.

> [card] [Embed a widget](https://docs.crispstats.com/share/widgets/embed.md)
>
> Script, iframe, README, Notion, shields.io and React.

> [card] [AI traffic](https://docs.crispstats.com/ai/ai-traffic.md)
>
> How visits from AI assistants are recognised.


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