Privacy-first product analytics where you own the data and don't want a consent banner or a third-party script.
Overview
Privacy-first page views + custom events sent to your own endpoint — no cookies, no localStorage IDs, no cross-site tracking, so no consent banner. Respects Do-Not-Track, auto-tracks SPA navigation, and uses sendBeacon so events survive page unload. Sends only a path, referrer host and an ephemeral per-load id.
.autoTrack()Auto page views on route change; returns a cleanup fn.
Tips
Call `analytics.autoTrack()` once from a client component in your layout to record SPA navigations automatically.
It sends only a path, referrer host and an ephemeral per-load id — no cookies, no persistent identifier.
Point `endpoint` at your own collector route; it uses `sendBeacon` so events survive page unload.
Zero-dependency and isomorphic — safe to import on the server, in the browser, on the edge and in React Native. It tree-shakes, so you only ship what you import.
Watch out for
It respects `navigator.doNotTrack` by default (`enabled` becomes false). Set `respectDNT: false` only if your policy allows.
You still need a backend endpoint to receive and store the events.
Looking for the complete API and more examples? The npm page and GitHub README carry the full reference — or grab the PDF.