Visitors
Visitors counts the people on your website: unique visitors, visits, pageviews, bounce rate, visit duration, sources and UTM tags, pages, countries, devices and goals. It uses no cookies and stores no personal data, so there's no consent banner to show. AI agents driving a browser are kept out of the human numbers.
Add the tag
If your site already loads the SDK for WebMCP, pageviews are already being recorded. Otherwise add one tag to the head of every page:
<script src="https://agentstats.io/sdk/v1.js" data-key="al_pub_…" async></script>
That's the full SDK: WebMCP tool calls and visitors. For a site with no WebMCP tools there's a lighter script (under 3 KB) that records visitors only:
<script src="https://agentstats.io/sdk/lite.js" data-key="al_pub_…" defer></script>
Single-page apps need nothing more: navigation with history.pushState is picked up. With npm, AgentStats.init() records pageviews too; pass trackPageviews: false to leave them out.
Goals
Send a custom event when someone does something that matters. It shows under Goals with its unique visitors, total and conversion rate. Click a goal to see only the visits that reached it, with each of its properties broken down by value.
AgentStats.track('Signup', { plan: 'pro' })
Properties can be strings, numbers or booleans, up to 30 per event. The same call works with v1.js and lite.js. With the full SDK it also counts as a conversion for the agent session it happens in.
Options
| Script tag | init() option | What it does |
|---|---|---|
data-pageviews="false" | trackPageviews: false | Full SDK only: leave pageviews out. |
data-hash-routing | hashRouting: true | Count the part after #/ as the page, for hash-based routers. |
data-outbound-links | outboundLinks: true | Record clicks on links to other sites as Outbound Link: Click, with the URL. |
data-file-downloads | fileDownloads: true | Record clicks on file links (PDF, ZIP, DMG…) as File Download. data-file-downloads="pdf,csv" sets your own extensions. |
data-allow-localhost | allowLocalhost: true | Record visits on localhost too. They're ignored by default, so development doesn't count. |
To leave your own visits out, run localStorage.agentstats_ignore = 'true' in the browser console on your site.
How visitors are counted
Each pageview is one small request. The server never stores the IP address or the user agent. It keeps:
- A visitor id: a hash of a daily random salt, the site, the IP address and the user agent. The salt is replaced every day and deleted after two, so an id can't be traced back to anyone, and the same person counts as a new visitor the next day. This is how Plausible counts.
- The page: host and path. The query string is dropped, apart from the
utm_*tags andref. - Where the visit came from: the
ref,sourceorutm_sourceparameter, else the referrer's host, with its path but not its query string. A link from your own site isn't a source. - Country, device size, browser and OS: the country from the request, the size from the window width, and the browser and OS names from the user agent.
A visit ends after 30 minutes without an event. A bounce is a visit with one pageview and no goal.
Agents aren't people
Pageviews from AI agents driving a real browser aren't counted as visitors: Claude in Chrome while it's in control, Claude's own browser, automation such as Playwright, agents the server SDK verified, requests from AI providers' IP ranges, and visits whose pages were operated the way agents operate them. For that last one the SDK sends counts and timings of how each page was used (pointer moves, clicks, key presses), never what was typed, where or on which element; agentSignals: false turns it off. They're counted separately, and the Visitors page says how many were left out. Crawlers and HTTP libraries are dropped.
Turning it off
Project settings → General → Website tracking → Visitors switches it off for the project: pageviews are dropped when they arrive. Pageviews count against the plan's monthly pageview quota, separately from events.