Overview
Sparklytics automatically groups events into sessions using a 30-minute inactivity timeout. Sessions are computed server-side — no client-side storage or cookies required.
How Sessions Work
Session Creation
A new session starts when:- A visitor’s first event is tracked, OR
- More than 30 minutes have passed since their last event
Session Timeout
From the README critical facts:Session timeout: 30 minutes inactivity, server-side, no cookies.If a visitor returns after 30+ minutes of inactivity, a new session is created.
Session Attributes
Each session captures:- Entry page: First pageview URL
- Exit page: Last pageview URL
- Referrer: Where the visitor came from
- Duration: Time from first to last event
- Pageview count: Number of pages viewed
- Event count: Total events (pageviews + custom events)
- Location: Country, region, city (from GeoIP)
- Device info: Browser, OS, device type
- UTM parameters: Source, medium, campaign
Listing Sessions
API Endpoint
Query Parameters
Start date in
YYYY-MM-DD format (defaults to 7 days ago)End date in
YYYY-MM-DD format (defaults to today)Number of sessions per page (1-200)
Pagination cursor from previous response
Response
Pagination
Sessions are returned in reverse chronological order (most recent first). To fetch the next page:crates/sparklytics-server/src/routes/sessions.rs:84:
Session Detail
Get the complete event timeline for a single session:Event Timeline
Events are returned in chronological order (oldest first) to show the user’s journey through the session.Truncation
If a session has more than 1,000 events, the timeline is truncated:Filtering Sessions
Apply filters to narrow down sessions:Available Filters
filter_country— ISO country code (e.g.,US,GB)filter_region— State/region namefilter_city— City namefilter_browser— Browser name (e.g.,Chrome,Safari)filter_os— Operating system (e.g.,macOS,Windows,iOS)filter_device— Device type:desktop,mobile, ortabletfilter_page— Entry page URL pathfilter_referrer— Referrer domainfilter_utm_source— UTM source parameterfilter_utm_medium— UTM medium parameterfilter_utm_campaign— UTM campaign parameter
Session Metrics
Aggregate session statistics are available via the stats endpoint:Bounce Rate
A session is considered a “bounce” if it contains only one pageview. From the CHANGELOG:Bounce rate SQL: must use CTEs. Correlated subqueries don’t work in DuckDB.Bounce rate = (sessions with 1 pageview) / (total sessions) × 100
Dashboard UI
The sessions page displays summary cards and a detailed table:Summary Cards
Fromdashboard/components/sessions/SessionsPage.tsx:30:
Sessions Table
The table shows:- Entry page
- Referrer domain
- Location (country, city)
- Browser and OS
- Duration
- Pageview count
- Timestamp
Use Cases
Understand User Journeys
See the exact path users take through your site:- Which pages lead to conversions
- Where users drop off
- How users navigate between features
Debug Tracking Issues
Verify that events are being tracked correctly:- Visit your site in a new incognito window
- Trigger some events
- Find your session in the dashboard
- Confirm all events appear in the timeline
Analyze High-Value Visitors
Filter sessions by conversion events:Support Customer Issues
If a user reports a problem, find their session:Performance
Session queries are optimized for speed:DuckDB (Self-Hosted)
- < 1M sessions: < 100ms per query
- 1M-10M sessions: 200-500ms
- Pagination: Cursor-based (no offset overhead)
ClickHouse (Cloud)
- < 10M sessions: < 50ms per query
- 100M+ sessions: < 200ms
- Scales horizontally: Add nodes for more throughput
Privacy Considerations
Visitor ID Rotation
Visitor IDs change daily at midnight UTC:- Sessions from different days cannot be linked to the same person
- Long-term tracking is not possible
- Privacy is preserved without cookies
No PII Storage
Sessions do NOT store:- IP addresses (used only for hashing, then discarded)
- Full user agents (parsed, then discarded)
- Email addresses or user IDs
- Any personally identifiable information
Best Practices
Set Reasonable Limits
Don’t fetch all sessions at once:Use Filters Effectively
Narrow down sessions before fetching:Cache Session Details
If showing a session detail modal, cache the result:Monitor Bounce Rate Trends
Track bounce rate over time to identify:- UX issues (sudden bounce rate spike)
- Content improvements (bounce rate decrease)
- Landing page effectiveness
Next Steps
Journey Analysis
Aggregate user paths across all sessions
Real-time Analytics
Monitor active sessions in real-time