Skip to content

Sessions

A session represents a continuous period of user activity on your site. Sessions are the foundation for engagement metrics like bounce rate, session duration, and pages per session.

What Is a Session

A session begins when a user first interacts with your site and ends after 30 minutes of inactivity. If the user returns after the timeout has elapsed, a new session is created. Sessions group related events together so you can understand user journeys as cohesive visits rather than isolated actions.

Session Lifecycle

Start

A session starts when:

  • A user loads your site for the first time
  • A user returns after the session timeout has elapsed (default: 30 minutes)
  • reset() is called, which forces a new session

When a session starts, the SDK sends a session_start event to the __analytics channel with referrer, UTM parameters, and device information.

Active

While the session is active, any user interaction (page view, click, custom event) resets the inactivity timer. The session remains open as long as the user continues interacting within the timeout window.

End

A session ends after 30 minutes with no user activity. There is no explicit "session end" event -- the server determines session boundaries based on the time gap between events.

Session Data

Each session contains the following data points:

FieldDescription
Session IDA unique UUID identifying the session
Start timeTimestamp of the first event in the session
End timeTimestamp of the last activity in the session
DurationTime between the first and last event
Event countTotal number of events recorded during the session
User IDThe identified user (if identify() was called during the session)
BrowserBrowser name and version
OSOperating system name and version
Device typeDesktop, mobile, or tablet
CountryCountry resolved from IP geolocation
RegionRegion or state
CityCity
Pages visitedList of page paths viewed during the session

Session Analytics

The Sessions page in the dashboard lets you explore sessions across your user base.

Session List

View all sessions with filtering options:

FilterDescription
Date rangeSelect a time window
EnvironmentSeparate production from staging or development
CountryFilter by geographic location
BrowserFilter by browser name
Device typeFilter by desktop, mobile, or tablet
UserSearch sessions by user ID

Session Detail

Click on any session to drill into its event timeline. The detail view shows every event that occurred during the session in chronological order, including:

  • Event name and channel
  • Timestamp
  • Tags and metadata
  • Page path

Session Metrics

MetricDescription
Session duration distributionHistogram showing how long sessions typically last
Events per sessionAverage number of events across sessions
Pages per sessionAverage number of distinct pages viewed

Bounce Rate

A "bounced" session is one where the user viewed only a single page before leaving. Bounce rate measures the percentage of these single-page sessions.

Bounce Rate = (Bounced Sessions / Total Sessions) x 100

A high bounce rate may indicate that users are not finding what they expect, or it may be normal for content like blog posts where a single page satisfies the visit. Interpret bounce rate in the context of your site's purpose.

Session Management in the SDK

The SDK provides methods to inspect and control sessions programmatically.

Get Session Info

typescript
const session = kitbase.getSession();
// => {
//   id: 'sess_abc123',
//   startedAt: 1705321800000,
//   lastActivityAt: 1705323600000
// }

Get Session ID

typescript
const sessionId = kitbase.getSessionId();
// => 'sess_abc123'

Force a New Session

typescript
kitbase.reset();
// Ends the current session and starts a new one
// Also clears the user ID (if set via identify)

Released under the MIT License.