Fixed kpi pageview stats when filtering by pathname#22674
Conversation
WalkthroughThe changes update the SQL logic in the web analytics API pipeline to improve date range handling and pageview calculations. The modified logic introduces a variable to detect single-day ranges and clarifies the handling of the end date by defaulting to the current day when needed. In the session metrics section, a subquery now conditionally counts pageviews only for hits matching a specific pathname. The node previously named 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (5)
⏰ Context from checks skipped due to timeout of 90000ms (5)
🔇 Additional comments (11)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
ref https://linear.app/ghost/issue/ANAL-162/
When filtering by path, the KPIs Pageviews metric is a bit odd. We effectively need to introduce a new 'context' - in general, the KPIs component shows the session metrics, but this is unintuitive when filtering by path, because you don't care how many pageviews all the sessions had that looked at the one particular path. Instead, you want to see the # of pageviews for that path only.
We should also update this to handle time on page instead of the entire session time in a separate change. Ideally, we end up reworking this entirely and use a different MV for page-based metrics, and we'll need to adjust the frontend to query a different endpoint.