Skip to main content
For anything new, use widgets instead. The live visitors widget shows the same count with no code of your own, hides small numbers, and works on your site, in a README and in Notion. This badge keeps working for pages that already use it.
The CrispStats live visitor badge shows how many people are on your site right now, on your own pages. You switch on Make the live count public in Settings, Sharing and widgets, copy the generated snippet, and paste it where the number should appear. The snippet calls a public endpoint on the collector that returns one number and nothing else about your traffic. The live count is separate from the public dashboard. You can publish the count while the dashboard stays private.

Add the badge

1

Make the live count public

Open your site, then Settings and the Sharing and widgets tab. Under Live visitor badge, switch on Make the live count public. Only owners and admins can change this switch.
2

Copy the snippet

The snippet appears below the switch with your site’s id and public key filled in. It looks like this:
Copy it from the dashboard rather than from this page, so SITE_ID and cs_pk_xxxxxxxx hold your real values.
3

Paste it into your page

Put the snippet where the number should appear, for example in a footer or next to a signup button. Style the span as you like. If the request fails, the snippet leaves the span empty, so nothing broken shows on your page.
4

Check it

Reload your page. The span shows a text such as 3 online now. If it stays empty, see Troubleshooting.

How the count works

The badge counts visitors seen on your site in the last 5 minutes. A visitor counts once, however many tabs or pages they have open. The collector caches the answer for 10 seconds per site and sends Cache-Control: public, max-age=10. Requests within those 10 seconds get the same number, so polling more often than every 10 seconds does not make the badge more current. The snippet fetches the count once, when the page loads. To keep the number current while the page stays open, fetch it again on a timer:

Endpoint reference

GET https://in.crispstats.com/live/{siteId}/count?k={publicKey} The endpoint needs no secret: the site id and the public key both appear in the snippet and are safe to publish. It answers any origin (Access-Control-Allow-Origin: *), so you can call it from any page.
string
required
Your site’s id, as filled in by the snippet in Settings, Sharing and widgets.
string
required
Your site’s public key, which starts with cs_pk_. It must belong to the site in the path.
number
Visitors on the site in the last 5 minutes.
200
404
The endpoint answers 404 with the same body when the site does not exist, when the key is wrong or belongs to another site, when Make the live count public is off, and when tracking for the site is paused or the account is suspended.

Turn the badge off

Switch off Make the live count public. The endpoint then answers 404, and the snippet leaves the span empty. The collector keeps site settings for up to a minute, so the change can take about a minute to apply. Remove the snippet from your pages as well, so they stop making the request.

Troubleshooting

Open your browser’s network tab and find the request to /live/.../count. A 404 means the live count is not public, or the site id or key in the snippet is not this site’s. Copy the snippet again from Settings, Sharing. If you just switched the live count on, wait a minute and reload.
The snippet contains the public key. After you issue a new key, copy the snippet again from Settings, Sharing and widgets and replace the old one on your pages.
Allow https://in.crispstats.com in connect-src. See Content Security Policy.
Your own visits may be excluded, for example by an excluded IP address or localStorage.crispstats_ignore, or the page may run on localhost, which the script ignores by default. Check from another device or network. See exclude traffic.

Next steps

Watch visitors live

See who is on your site right now in the Realtime view.

Share a public dashboard

Give anyone with a link a read-only view of your traffic.

Publish a status page

Show your uptime and recent incidents on a public page.
Last modified on November 24, 2026