Bugfix: adjustments to querying time:minutes and time:hours dimensions for goal conversion#6187
Closed
Bugfix: adjustments to querying time:minutes and time:hours dimensions for goal conversion#6187
Conversation
|
cf6cbde to
541b6dc
Compare
541b6dc to
9b471c4
Compare
zoldar
reviewed
Mar 24, 2026
| defp smear_session_metrics({:sessions, metrics} = value, query) do | ||
| if "time:minute" in query.dimensions or "time:hour" in query.dimensions do | ||
| if ("time:minute" in query.dimensions or "time:hour" in query.dimensions) and | ||
| :group_conversion_rate not in query.metrics and |
Contributor
There was a problem hiding this comment.
Given that bypass_session_smearing? is set to true on adding group_conversion_rate metric, is this condition necessary? 🤔
zoldar
approved these changes
Mar 24, 2026
Member
Author
|
To be fleshed out further, I have no idea what I'm doing and @ukutaht is pointing at different direction. Closing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Disclaimer: my confidence about this solution is close to zero 😅
https://sentry.plausible.io/organizations/plausible/issues/1101/?environment=prod&project=2&query=is%3Aunresolved%20issue.priority%3A%5Bhigh%2C%20medium%5D&referrer=issue-stream - when querying timeseries with
time:minute` interval and a goal filter, the app would crash with `** (Ecto.QueryError) lib/plausible/stats/sql/special_metrics.ex:114: field `visitors` does not exist in subquery in query.For
time:minute, session visitor counts are split into a separate "smeared" subquery. The conversion rate calculation then tries to read visitors from the events subquery - but visitors is no longer there, because table decider moves it to another query. The fix is to skip that split entirely whengroup_conversion_rateis in the query.Tests
Changelog
Documentation
Dark mode