Skip to content

Allow revenue metrics to be queried with session dimensions#6211

Merged
ukutaht merged 5 commits intomasterfrom
allow-revenue-metrics-with-session-dims
Mar 31, 2026
Merged

Allow revenue metrics to be queried with session dimensions#6211
ukutaht merged 5 commits intomasterfrom
allow-revenue-metrics-with-session-dims

Conversation

@ukutaht
Copy link
Copy Markdown
Contributor

@ukutaht ukutaht commented Mar 31, 2026

Changes

Allows revenue metrics to be queries with session dimensions. Prepares for refactoring entry page breakdown to APIv2 code.

Tests

  • Automated tests have been added

Changelog

  • Entry has been added to changelog

Documentation

  • Docs have been updated

Dark mode

  • This PR does not change the UI

@ukutaht ukutaht requested a review from RobertJoonas March 31, 2026 12:02
|> dimensions_used_in_filters()
|> Enum.any?(&(dimension_partitioner(query, &1) == :session))

group_session_dims =
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is needed not for the dashboard but for API. In the dashboard we always add a [:is_not, "visit:entry_page", ""] filter to queries so checking filters is enough. We can't expect that there's always a filter present in API queries.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it make sense to extend the check the same way sessions_join_events? ?

|> dimensions_used_in_filters()
|> Enum.any?(&(dimension_partitioner(query, &1) == :session))

group_session_dims =
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it make sense to extend the check the same way sessions_join_events? ?

@ukutaht
Copy link
Copy Markdown
Contributor Author

ukutaht commented Mar 31, 2026

Would it make sense to extend the check the same way sessions_join_events? ?

@zoldar no, the line on

not empty?(session_only_metrics) and not empty?(event_only_dimensions) ->
guards against session metrics being requested for event dimensions so adding the same extension to sessions_join_events would be a no-op.

I had to change events_join_sessions? because we now allow revenue metrics (limited set of event metrics) being requested with session dimensions like entry_page or source.

@zoldar
Copy link
Copy Markdown
Contributor

zoldar commented Mar 31, 2026

@ukutaht got it. If that would ever change and there would be similar exclusions the other way around, the logic would have to be altered anyway and doing that up front would only muddle it up.

Copy link
Copy Markdown
Contributor

@RobertJoonas RobertJoonas left a comment

Choose a reason for hiding this comment

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

Thanks for this @ukutaht! Looks good to me! 👍

@ukutaht ukutaht added this pull request to the merge queue Mar 31, 2026
Merged via the queue into master with commit 7b18ffc Mar 31, 2026
23 checks passed
@ukutaht ukutaht deleted the allow-revenue-metrics-with-session-dims branch March 31, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants