Ship analyticshq in one line.
One first-party script under 2 KB, a tiny client call for custom events, and a read API for your numbers. No cookies, no consent banner, and no SDK to learn.
Install the script
Add one tag to your site head with your site ID. It loads deferred and first-party, and starts counting page views right away, including client-side route changes in single-page apps.
<script defer
src="https://analyticshq.org/script.js"
data-site="YOUR_SITE_ID"></script>
Track custom events
Once the script has loaded it puts a analyticshq() function on the page. Call it on any event that matters, with optional properties, to record a conversion beside your traffic.
// e.g. right after a successful signup
analyticshq('signup', {
plan: 'pro',
value: 19,
})
Read your numbers with the API
Every figure on the dashboard is available over a small read API, scoped to your site ID and an optional date range. Wire it into a status board, a scheduled report, or your own UI.
GET /api/sites/{siteId}/stats // visitors, views, sessions
GET /api/sites/{siteId}/timeseries // views per day
GET /api/sites/{siteId}/pages // top pages
GET /api/sites/{siteId}/referrers // top sources
// example
fetch('https://analyticshq.org/api/sites/demo/stats?from=2026-07-01&to=2026-07-10')
.then(r => r.json())
// { "views": 8, "visitors": 4, "sessions": 4 }
Own your data, self-host if you want
Every event lands in your own PostgreSQL database, so the numbers never leave your infrastructure and there is no third party to trust. The whole stack is open source.
Start counting visitors, privately.
Add the script, watch the dashboard fill in. No cookie banner required.