6 min read

Core Metrics, Sessions & Live View

Learn how visitors, sessions, bounce rate, and active dwell time work, plus how TrimStats calculates core KPIs and click-to-filter segments.

Imtiaz Rayhan
Imtiaz RayhanCo-Founder & Lead Engineer, DotCamp & TrimStats
Verified against live TrimStats APIs
Quick reference

How does TrimStats calculate sessions, live visitors, bounce rate, and dwell time?

TrimStats counts live visitors over a rolling 300-second (5-minute) window, groups visits into sessions using a 30-minute sliding inactivity timeout, calculates active dwell strictly while browser tabs are visible, and defines bounce rate as <= 1 pageview AND < 10 seconds of active dwell.

Understanding visitors, sessions, and bounce rate

Web analytics groups raw browser hits into three layers: pageviews, sessions, and visitors. Understanding how these differ prevents misreading traffic reports.

  • Visitor vs Session vs Pageview: Suppose one reader opens your blog at 9:00 AM, reads two posts, closes the tab, and returns at 2:00 PM to check /pricing. That generates 1 unique visitor, 2 sessions (separated by more than 30 minutes of inactivity), and 3 pageviews.
  • Why traditional bounce rate penalizes good content: Legacy tools mark any single-page visit as a bounce, even if someone spent 5 minutes reading your entire tutorial. TrimStats only counts a session as a bounce when it has <= 1 pageview and less than 10 seconds of active visible time.
  • Why active visit time beats wall-clock time: Leaving a browser tab open in the background for 40 minutes inflates averages in naive trackers. TrimStats pauses its timer whenever the tab hides so Avg. Active Time reflects real attention.
Site analytics / Overview
Overview KPIs compare automatically against the preceding equal window. Click Unique Visitors, Pageviews, or Sessions to switch the main trend chart.

How core KPIs are calculated

Every metric in the site Overview dashboard is computed directly in ClickHouse and compared automatically against the immediately preceding window of the same length.

MetricFormula / RuleNotes
Live visitorsDistinct visitors active within the last 5 minutes (300 s)Served in sub-millisecond time from Valkey/Redis sorted sets (live:{siteId}).
VisitorsDistinct visitor_id values (uniqCombined64) with pageview activity in the date rangeScoped per UTC day in cookie-less mode; persistent across days in first-party or identified mode.
SessionsDistinct session_id UUIDs created with a 30-minute sliding inactivity timeoutEach incoming event refreshes the 30-minute session TTL automatically.
Bounce ratePercentage of sessions with pageviews <= 1 and active duration_ms < 10,000 (10 seconds)Visitors who read a single blog post for more than 10 seconds are not penalized as bounces.
Visit time (Avg. duration)sum(active_duration_ms) / sessionsUses visibility-aware active time only; hidden background tabs do not inflate visit time.
Views / sessionpageviews / sessions rounded to 2 decimal placesMeasures depth of navigation across multi-page sessions.

Breakdowns & click-to-filter segments

Aggregate site totals hide important differences between audiences. Segmentation slices every KPI and table down to a specific subset of traffic, such as visitors arriving from google.com or mobile readers landing on /pricing.

The Overview report aggregates the top 25 items per dimension in parallel: Top pages, Entry pages, Exit pages, Referrers, UTM sources, UTM campaigns, Countries, Devices, Browsers, Operating systems, and Custom / outbound / download events.

Site analytics / Overview (filtered segment)
Clicking google.com in Acquisition adds an active filter pill at the top and recalculates all KPIs and breakdown cards for search visitors alone.
Instant multi-dimensional filtering

Click any row in a breakdown card (such as a specific country, referrer, UTM campaign, device type, browser, OS, or pathname) to filter the entire Overview chart, KPIs, and all other breakdown tables by that segment.

Visitors directory & chronological timelines

Open the Visitors tab for any site to inspect live and recently active visitors, search by external_user_id, visitor_id, or visited pathname, and click any visitor to open their chronological journey panel.

Site analytics / Visitors & Timeline
Each visitor panel merges acquisition source, lifetime revenue, session groupings, per-page active dwell time, and custom event properties into one chronological stream.
  • Displays each visitor identity mode badge (cookieless, first_party, or identified), location, device/browser/OS, first referrer, and initial UTM tags.
  • Merges pageviews (with matched per-page active dwell duration), custom events with JSON properties, outbound clicks, downloads, scroll milestones, UI friction events, and attributed revenue transactions into one chronological stream.
  • Supports up to 730 days of visitor lookback (default 90 days) when persistent identity is active.

Common technical questions

Why is TrimStats bounce rate lower and more accurate than legacy analytics on blogs?
Legacy tools mark any single-page visit as a bounce even if the reader stayed 4 minutes. TrimStats requires both <= 1 pageview and < 10 seconds of visibility-aware active dwell before counting a session as bounced.
How many rows appear in each TrimStats dashboard breakdown table?
Breakdowns for pages, referrers, UTM parameters, countries, devices, browsers, and operating systems return the top 25 items per query with instant click-to-filter multi-dimensional segmentation.

Related guides