-
-
Notifications
You must be signed in to change notification settings - Fork 636
Bug: Session duration in channel filter view is inconsistent with user detail view #959
Description
Description
There is a significant inconsistency between the session duration displayed in the channel filter view and the session duration shown in the user detail view for the same sessions.
Steps to Reproduce
- Open the main dashboard for today
- Note the overall average session duration (e.g. 5m 58s)
- Filter by channel → Organic Search (Google)
- Note the session duration shown for 2 visitors → 21 seconds
- Navigate to the Users view and click on each of those same 2 visitors
- Observe their individual session durations:
- User 1 via Google: 3 min 7 sec
- User 2 via Google: 6 min 31 sec
Expected Behavior
The average session duration shown in the channel filter view should match the mathematical average of the individual user session durations:
(3:07 + 6:31) / 2 = ~4 min 49 sec
Actual Behavior
The channel filter view shows 21 seconds for the same two sessions — roughly 14x lower than what the user detail view reports. Both users are flagged as first-time visitors (no returning session overlap to explain the discrepancy).
Impact
This makes the channel-level session duration metric unreliable and potentially misleading when comparing traffic sources (e.g. Direct vs. Organic Search).
Possible Root Cause
The bug may be related to how session_duration is calculated or aggregated when a channel filter is applied in the ClickHouse query. A similar issue was previously found in the Sessions API pagination where page=undefined caused a NaN offset (fixed in #630). It is possible that the channel filter query either:
- Only counts the duration up to the first event in the session rather than
MAX(timestamp) - MIN(timestamp) - Drops or truncates session duration when joining with channel attribution data
- Uses a different measurement method than the user detail view
Environment
- Observed on the main dashboard → Channels filter → Organic Search (Google)
- Compared with: Users tab → individual user detail view
- Both affected users are marked as first-time visitors
Additional Context
The overall unfiltered average session duration (5m 58s) appears mathematically plausible given the individual user values, suggesting the issue is specific to the filtered channel aggregation query and not the underlying raw event data.