Visitors, sessions & identity
StatsKit attributes every event to a visitor and a session. Understanding how those are assigned, and how you can attach a known user, is the key to reading your results correctly.
Visitors
Section titled “Visitors”A visitor is a persistent identity for a browser. The tracker assigns each one a UUID (visitor_id) and stores it in the statskit_visitor_id cookie, so the same person is recognized across visits.
Sessions
Section titled “Sessions”A session groups a burst of activity. The session_id is stored in the statskit_session_id cookie and rolls over after 30 minutes of inactivity, starting a fresh session on the visitor’s next event.
Tying in a known user
Section titled “Tying in a known user”When you know who someone is (after they log in, for example), attach that identity to the visitor:
statskit.identify('user_123', { plan: 'growth', email: 'jo@example.com' });This links the known user ID to the current visitor_id, along with any traits you pass. On logout, clear the identity so the next person on the same browser isn’t merged into it:
statskit.reset();See Identify users for the full API.
Cookieless mode
Section titled “Cookieless mode”If you’d rather not set cookies, run the tracker in cookieless mode:
<script defer src="https://cdn.statskit.ai/v.js" data-site-id="vpk_live_…" data-api="https://edge.statskit.ai" data-mode="cookieless"></script>In this mode the tracker uses sessionStorage instead of cookies, and the visitor identity rotates roughly every 24 hours. That trades away cross-session stitching (you can’t recognize a returning visitor after rotation) in exchange for not needing a consent banner.
See Advanced tracking for more configuration options.