Set up the live visitors widget
A small card on your own site that greets each visitor by country ("Hey visitor from Germany π©πͺ") and can show how many people are on the site right now. You write the message once in Chartsy, paste one snippet, and change the message or look later without touching your site again.
Before you start#
The widget runs on a site you track in Chartsy. If you haven't added one yet, add it under Settings β Website tracking β Sites with the domain the widget will run on. The widget only appears on that site's domains and their subdomains.
You don't need the tracking script for the widget to work, but with it installed the live count covers every tracked page, not only pages that show the widget.
Set up the widget#
- Go to Settings β Website tracking β Live visitors widget and pick the site.
- Click Set up my widget, write your message and choose the options below. The preview shows the widget on light and dark backgrounds as you go.
- Save, then click Copy snippet and paste it into your site.
Settings#
- Your message
- Up to 280 characters. Use Insert a placeholder to add
{country}and{flag}.Hey visitor from {country} {flag}!reaches a visitor in Germany as "Hey visitor from Germany π©πͺ!". Visitors whose country is unknown see "around the world". - Show how many people are here now
- Adds a live count, such as "12 people here now", above your message. Turn it off to show only the greeting.
- Where it appears
- Bottom right or Bottom left float over the page, and visitors can close them. Inline sits exactly where you paste the snippet.
- Theme and accent colour
- Auto follows each visitor's light or dark mode; Light and Dark fix it. The accent colour is used for the button.
- Button text and button link
- An optional call-to-action, for example "Start free trial" linking to your pricing page. The link must be a full address starting with
https://. - Status
- Turn it off to pause the widget on your site without removing the snippet. Turn it on again to bring it back.
No re-pasting
Message and style changes apply as soon as you save. The snippet on your site stays the same.
Add the snippet#
The snippet is a small credit link plus one script tag, with your site's own key:
<a href="https://chartsy.app/?utm_source=live-widget&utm_medium=widget"
data-chartsy-live="ch_pk_...">Live visitors by Chartsy</a>
<script async src="https://chartsy.fra1.digitaloceanspaces.com/production/static/live.js"
data-api="https://dashboard.chartsy.app/api/attribution"></script>- Floating widget: paste it anywhere on the page, for example just before
</body>. - Inline widget: paste it exactly where the widget should appear. The card replaces the spot where the link sits.
- Copy the snippet from your settings rather than this page, so it carries your key.
The link stays in your page's HTML and becomes the small "Live visitors by Chartsy" credit inside the card. If the script can't run, visitors see just the link. The widget's styles live in a shadow DOM, so your site's CSS can't change it and it can't change your site.
On a React or Next.js site, render the link where the widget should go and load the script with your framework's script component (for example next/script), keeping the data-api attribute. On Webflow, WordPress and similar builders, paste the snippet into a custom code or HTML embed block - see install by platform for where that lives.
How the live count works#
The count is the number of people active on your site in the last five minutes. An open widget checks in every 30 seconds, and stops while its tab is hidden. With the tracking script installed, its heartbeat feeds the same count from every tracked page, and someone on a page with both scripts is still counted once.
When you preview the widget from localhost, you see it but aren't counted as a visitor.
Privacy#
- No cookies, and nothing stored on the visitor's device.
- Presence is kept only in memory, under an identifier that rotates daily. No per-visitor record is written to a database.
- The widget doesn't count against your plan's event allowance.
- It only answers on your site's own domains, so nobody can copy your key and show your numbers on another site.
Troubleshooting#
- Only the "Live visitors by Chartsy" link shows
- The widget answered nothing, so it left the plain link. Check that the page's domain is listed for the site under Settings β Website tracking β Sites (subdomains are covered; to test locally, add
localhost), that the widget's Status is on, and that the snippet'sdata-chartsy-livekey matches the site. - Nothing shows at all
- Check that the script tag is on the page and keeps its
data-apiattribute. If you chose a floating placement, look in the bottom corner rather than where you pasted the snippet - the card appears about a second after the page loads. A visitor who closed the floating widget won't see it again until they reload. - The widget is in the wrong place
- Floating placements always sit in a corner. To put the widget inside your page, choose Inline and move the snippet's link to where it should appear.
- The count seems low
- Only people active in the last five minutes are counted, and your own previews from localhost are left out. Install the tracking script so pages without the widget count too.


