Skip to content

feat: add session dimensions and allow overview filters #32734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 28, 2025

Conversation

lricoy
Copy link
Member

@lricoy lricoy commented May 27, 2025

This PR enables bounce-rate calculations filtering and filtering the WebOverview tiles.

Problem

We don't have a reliable way to average over session properties. To make the overview filters work on the non-preaggregated version, we filter the events we care about before aggregating. This is not possible on pre-aggregated tables since we are, well, pre-aggregating them; therefore, we need to do it in a way that allows future filters to query arbitrary sections of the data.

This PR enables this by adding session dimensions (essentially the entry values of the session) to the web_bounces_daily table, which is the table used for displaying bounce rates.

This allowed us only to need two tables at the end:

  • web_stats_daily, which will have a more event-based breakdown.
  • web_bounces_daily, which has session-oriented dimensions and bounce rate calculations.

The main difference between them is that web_stats_daily will have metrics for pathnames events, while web_bounces_daily doesn't, but has metrics like session_duration.

P.S. The names are still temporary, but the queries to generate those others are heavy, so I am trying to squish as much as possible from the ones we can have while keeping a close eye that we're not duplicating session data on web_bounces_daily.

Changes

  • Removed web_paths_daily as we can now use the web_stats_daily for that
  • Removed web_overview_daily as we can now use web_bounces_daily for bounce and session-dimensions filters
  • Enabled the dimensions as filters on the WebOverview query

Did you write or update any docs for this change?

  • I've added or updated the docs
  • I've reached out for help from the docs team
  • No docs needed for this change

How did you test this code?

Manually, basically if the pre-aggregated values matched the regular queries :)

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR optimizes web analytics pre-aggregation by consolidating tables and adding session dimensions for enhanced filtering capabilities.

  • Consolidates four tables into two: web_stats_daily (event-based) and web_bounces_daily (session-oriented), removing web_overview_daily and web_paths_daily
  • Adds session dimensions (browser, OS, viewport, UTM params) to web_bounces_daily for granular filtering
  • Splits viewport field into width/height components in pre-aggregated tables
  • Updates Dagster pipeline definitions to reflect table consolidation
  • Implements pathname filtering workaround by mapping to entry_pathname in WebOverview queries

8 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

@lricoy lricoy requested review from a team, robbie-c and jabahamondes and removed request for a team May 27, 2025 23:15
@lricoy
Copy link
Member Author

lricoy commented May 28, 2025

There were some conflicts with the Path Cleaning. I've fixed them, and it should be fine, but I will check the CI results to be sure

Copy link
Contributor

@jabahamondes jabahamondes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🫡

@lricoy lricoy merged commit 2460d5e into master May 28, 2025
96 checks passed
@lricoy lricoy deleted the feat/pre-agg-session-dimensions branch May 28, 2025 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants