Sessions
How sessions are tracked: lifetime, entry and exit, and bounce.
A session is a single visit. The browser SDK tracks it automatically; you don't call anything.
What a session captures
- A unique session ID, stamped onto every event in the visit.
- Entry and exit pages, pages viewed, and duration.
- Bounce: a short, single-page visit.
- Referrer, UTM, device, and geo (the event envelope).
Lifetime
A session starts on the first page load and ends after 30 minutes of inactivity. Returning within the window continues the same session; returning later starts a new one. Sessions persist across tabs and survive a tab close within the window.
Server events join a session
Backend events are stateless and don't create sessions. To tie a server event to the browser session, pass the session ID when you bind the user:
const user = trodo.forUser('user-42', { sessionId });
await user.track('invoice_paid', { amount_cents: 9999 });user = trodo.for_user('user-42', session_id=session_id)
user.track('invoice_paid', {'amount_cents': 9999})Pass the session ID from the browser to your API (for example in a request header or a cookie you read server-side).
Next
- Auto-capture for the events recorded within a session
- Events to add your own