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

# Live visitors widget

> Show how many people are on your site right now as a pill, a card with per-minute bars and top countries, or a README badge, with a floor that hides small numbers.

The live visitors widget shows how many people are on your site right now, and keeps the number current while the page is open. It counts the same visitors as the [Realtime](https://docs.crispstats.com/dashboard/realtime.md) view: anyone seen on the site in the last 5 minutes, once however many tabs they have open.

![A pill with an orange dot reading 99 people online now, and the CrispStats mark](https://mintcdn.com/crispstats/E7Fpqdyq9pa1UkLm/images/widgets/live-pill-light.png?fit=max\&auto=format\&n=E7Fpqdyq9pa1UkLm\&q=85\&s=a729fe1567f756a10c453602b092e87f)

Live visitors pill

![A card headed Live now showing 99, with 30 bars for the last 30 minutes and the footer Visitors in the last 5 minutes](https://mintcdn.com/crispstats/E7Fpqdyq9pa1UkLm/images/widgets/live-card-light.png?fit=max\&auto=format\&n=E7Fpqdyq9pa1UkLm\&q=85\&s=f92ebd640dd72263d946d00143dcc46e)

Live visitors card

![A line with an orange dot reading 100 people online now, with no box around it](https://mintcdn.com/crispstats/E7Fpqdyq9pa1UkLm/images/widgets/footer-pill-light.png?fit=max\&auto=format\&n=E7Fpqdyq9pa1UkLm\&q=85\&s=85b7b869c9b99f3fc34134568cbbbcc8)

Footer pill: size Small, plain style

## Layouts

| Layout | What it shows |
| - | - |
| Pill | A dot in the accent colour and one sentence: `14 people online now`, or `1 person online now`. It fits every size. Screen readers hear the site as well: "14 people on quillbook.com now". |
| Card | **Live now**, the figure, one bar for each of the last 30 minutes (the current minute drawn solid) and the footer `Visitors in the last 5 minutes`. At size Large with **Countries** on, up to three countries with their visitors. |
| Badge | An image with `live now` on the left and the count on the right, for a README. Images are cached by proxies, so a badge lags a few minutes behind. |

**Label** replaces the words after the number: with the label `people reading now`, the pill reads `14 people reading now`, and the card's heading changes too. Put your site's name in the label if you want it on the pill, such as `readers on Quillbook`. A label has at most 40 characters and no digits: numbers come from your data. If a label is too long for the pill's size, the widget screen says "This label is cut off at this size. Pick a larger size or a shorter label." and the pill would end it with an ellipsis.

## Small numbers

A count of one or two people tells a visitor more than it should, and it looks empty. **Hide below** sets the floor (default 3, from 1 to 20). Under it, **Below the floor** decides what shows:

| Setting | Between 1 and the floor | At 0 |
| - | - | - |
| **Say a few** (default) | `A few people online now`, or `A few people reading now` with a label | Hidden |
| **Hide** | Hidden | Hidden |

A hidden widget takes no space on your page. The number never leaves CrispStats while it is under the floor, not even in the [JSON](https://docs.crispstats.com/share/widgets/json-api.md).

Countries follow a floor of their own: a country appears only with at least 3 visitors on the site right now, and the card shows at most 3. Country names only: no cities, regions or flags.

## How it stays current

The script asks for a new count about every 30 seconds, give or take a fifth so that many pages do not ask at the same moment, while the widget is on screen and the tab is visible. It stops after 40 updates on a page left open and starts again when the reader comes back to the tab. Screen readers hear the new count at most once a minute.

The collector answers from the live presence it already keeps for the [Realtime](https://docs.crispstats.com/dashboard/realtime.md) view and caches the answer for 10 seconds, so asking more often does not make the number more current.

## Add it

1. Open **Settings**, **Sharing and widgets** and pick **Live visitors pill**, **Live visitors card** or, for a footer, **Footer pill** (small, in the plain style, hidden below the floor).
2. Set the label, the floor and the style, then select **Create widget**.
3. Copy the code from the **HTML** tab and paste it where the count should show:

```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:264px;height:36px"></crispstats-widget>
```

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

## The live visitor badge

The older [live visitor badge](https://docs.crispstats.com/share/live-visitor-badge.md), a snippet that fetches one number from `/live/<site id>/count`, keeps working for pages that already use it. Widgets replace it for anything new: they need no code of your own, hide small numbers and come in every format.

## Next steps

> [card] [Traffic figures](https://docs.crispstats.com/share/widgets/stat.md)
>
> Visitors, pageviews and sessions over a range.

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

> [card] [Watch visitors live](https://docs.crispstats.com/dashboard/realtime.md)
>
> The Realtime view behind the count.


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