Sessions
Understand how FlashAnalytics groups user activity into sessions for visit-level analytics, personalization, and current-session logic.
Sessions group related user activity into a single visit-level unit. They help you understand what happened during one continuous usage window rather than across the entire lifetime of a user profile.
Typical session use cases:
- visit-level analytics such as session duration, pages per session, and bounce rate
- personalization based on current behavior
- funnel and conversion logic scoped to the current visit
- rule engines that react to short-term activity
Table of Contents
- Overview
- When a Session Starts
- How a Session Stays Active
- When a Session Ends
- Session Timeline Examples
- SDK Behavior
- Best Practices
- Caveats
Overview
A session represents one continuous period of activity from the same device or browser.
In practice, a session:
- starts when the first tracked event arrives
- stays active while new events continue to arrive
- ends after an inactivity gap
If a user starts anonymously and is identified later, FlashAnalytics keeps the live session and associates it with the identified profile.
When a Session Starts
A new session starts when FlashAnalytics receives an event for a device or browser that does not currently have an active session.
Common examples:
- a user lands on a page and the first
page_viewis tracked - a user opens the app and triggers a custom event
- a returning user sends a new event after the previous session has timed out
When a new session starts, FlashAnalytics also creates a system session_start event. This keeps session reporting consistent across the product.
How a Session Stays Active
FlashAnalytics uses a 30-minute inactivity window.
This is a sliding window, not a fixed one. Every new tracked event extends the active session window.
Examples:
- a user loads a page and clicks again 5 minutes later: same session
- a user keeps generating events every few minutes: same session continues
- a user triggers an event at minute 29: the session stays alive and now gets another 30 minutes from that event
There is no hard maximum session length as long as activity continues.
When a Session Ends
A session ends when no new tracked activity is received for 30 minutes.
After that inactivity threshold is crossed, FlashAnalytics closes the session in the background and creates a system session_end event.
That close finalizes session-level values such as:
- session duration
- bounce status
This means session-based reporting becomes fully final after the session closes.
Session Timeline Examples
Example 1: Activity extends the session
- First event arrives at
10:00 - Another event arrives at
10:10 - Another event arrives at
10:28
The session does not end at 10:30. It remains active until about 10:58, unless another event arrives before then.
Example 2: No further activity
- First event arrives at
10:00 - No other events arrive
The session becomes eligible to end at about 10:30.
Important nuance
The logical timeout is 30 minutes of inactivity. The final close happens shortly after that through background processing, so session finalization is near-real-time rather than exactly at the timeout second.
SDK Behavior
FlashAnalytics SDKs can expose the current session ID after the first successful tracking response returns one.
const sessionId = flashAnalytics.getSessionId()What this means:
- after the first tracked event, the SDK can learn the current
sessionId - later events during the same active session continue using that session context
- when a new session starts later, the SDK can receive and store the new session ID
For web SDK usage, the session ID is also stored in browser session storage so it can survive navigation and reloads during the same browser visit.
Best Practices
- Use sessions for visit-level analysis, not long-term user history.
- Use profiles when you need continuity across multiple visits.
- Base per-session logic on active behavior such as page views, conversions, and event count.
- Wait until a session has closed before treating final session metrics as complete.
Good session-based use cases:
- show a message once per session
- count one conversion per session
- trigger logic after three page views in the same visit
- personalize content based on current-session behavior
Caveats
Sessions are activity-based
Opening a browser tab does not keep a session alive by itself. Only tracked activity does.
Long visits can remain one session
If events keep arriving, the session keeps extending.
The same user can have many sessions
If a user comes back after the inactivity window, FlashAnalytics treats that as a new session. That is expected behavior for visit-based analytics.
Session and profile analysis answer different questions
- use session when you care about one visit
- use profile when you care about the same user over time
