Skip to main content

Overview

Loom’s session analytics system tracks user engagement periods to enable release health metrics like crash-free rate and adoption tracking. Uses hybrid storage: individual sessions for recent data (30 days) and hourly aggregates for historical dashboards.
Sessions integrate with crash tracking for crashed session detection and analytics for person identity.

Key Features

  • Session tracking for web, Node.js, and Rust applications
  • Release health metrics: crash-free rate, adoption percentage
  • Hybrid storage: individual sessions (30 days) + hourly aggregates (forever)
  • Sampling support for high-volume applications
  • Real-time updates via SSE for release health changes

Core Concepts

Session

A single user engagement period:
Session statuses:

Platform Types

Release Health

Computed metrics for a release:
Adoption stages:

Automatic Tracking

Sessions are automatically tracked by the crash SDK:

Session Lifecycle

Web (Browser)

1

Page Load

Session starts when SDK initializes
2

User Activity

Session remains active while user interacts
3

Tab/Window Close

Session ends via beforeunload or pagehide event
4

Visibility Timeout

If page hidden for 30+ minutes, session ends and new one starts when visible again

Node.js / Rust

1

Process Start

Session starts when crash client initializes
2

Process Exit

Session ends normally on clean shutdown
3

Uncaught Exception

Session marked as Crashed on unhandled error

Sampling

For high-traffic applications, reduce storage with sampling:
Crashed sessions are always stored regardless of sample rate. Only successful sessions are sampled.

Sampling Rules

  1. Base sample rate (e.g., 0.1 = 10%)
  2. Always store crashed (recommended: true)
  3. Metrics are automatically adjusted for sample rate
Example calculation:

Release Health Metrics

Crash-Free Session Rate

Percentage of sessions without unhandled errors:
Example:
  • Total sessions: 10,000
  • Crashed sessions: 50
  • Crash-free rate: 99.5%

Crash-Free User Rate

Percentage of users who didn’t experience crashes:
Example:
  • Total users: 1,000
  • Users with crashes: 25
  • Crash-free user rate: 97.5%
User rate is typically lower than session rate because one user can have multiple sessions.

Adoption Rate

Percentage of traffic on this release:
Example:
  • Release 1.2.3 sessions: 7,500
  • All sessions: 10,000
  • Adoption rate: 75% (Adopted stage)

API Endpoints

Session Ingestion (SDK)

POST /api/sessions/start
endpoint
Start a sessionRequest:
POST /api/sessions/end
endpoint
End a sessionRequest:

Release Health (User Auth)

GET /api/projects/:id/releases
endpoint
List releases with health metricsQuery Parameters:
  • environment - Filter by environment
  • start_date - Start of time range
  • end_date - End of time range
Response:
GET /api/projects/:id/releases/:version
endpoint
Get detailed health for specific releaseResponse:
GET /api/projects/:id/health/trend
endpoint
Get health trend over timeQuery Parameters:
  • interval - hour, day, week
  • start_date - Start timestamp
  • end_date - End timestamp
Response:

Session Queries

GET /api/projects/:id/sessions
endpoint
List recent sessionsQuery Parameters:
  • release - Filter by release
  • status - Filter by status (active, exited, crashed)
  • limit - Max results (default: 100)
GET /api/projects/:id/sessions/:sessionId
endpoint
Get session detailResponse:

Real-time Updates (SSE)

Subscribe to release health changes:
Events:
  • session.started - New session started
  • session.ended - Session ended
  • session.crashed - Session marked as crashed
  • release.health_changed - Release health metrics updated

Aggregation & Retention

Storage Strategy

Individual Sessions

Retention: 30 daysPurpose: Debugging, detailed analysisFull session data with all context

Hourly Aggregates

Retention: ForeverPurpose: Long-term dashboards, trendsRolled-up counts and statistics

Hourly Aggregation

Every hour, individual sessions are aggregated:
After 30 days, individual sessions are deleted but aggregates remain.

Metric Definitions

Best Practices

Set Release Version

Always set release to track health per versionUse semantic versioning or commit SHA

Use Sampling

For high-traffic apps, sample normal sessionsCrashed sessions are always stored

Monitor Trends

Track crash-free rate trends over timeAlert on significant drops

Environment Separation

Separate production/staging environmentsMonitor both independently

See Also

Crash Tracking

Investigate crashed sessions

Analytics

Link sessions to person profiles