Skip to content

Funnel steps breakdown - #4949

Merged
EDsCODE merged 17 commits into
masterfrom
funnel-steps-breakdown
Jul 6, 2021
Merged

EDsCODE merged 17 commits into
masterfrom
funnel-steps-breakdown

Conversation

@EDsCODE

@EDsCODE EDsCODE commented Jun 30, 2021 •

Copy link
Copy Markdown
Collaborator

Changes

Please describe.

  • adds ability to view broken down funnel steps (5 at a time)
  • only event and person prop breakdowns in this PR
  • api parameters are the same as for trends.
  • Current funnel step results [...funnel steps]. New funnel step with breakdown result" [[... funnels steps for breakdown value 1], [... funnels steps for breakdown value 2], ....]

If this affects the frontend, include screenshots.

Checklist

  • All querysets/queries filter by Organization, by Team, and by User
  • Django backend tests
  • Jest frontend tests
  • Cypress end-to-end tests
  • Migrations are safe to run at scale (e.g. PostHog Cloud) – present proof if not obvious
  • Frontend/CSS is usable at 320px (iPhone SE) and decent at 360px (most phones)
  • Breaking changes are backwards-compatible. Ensure old/new frontend requests work with new/old backends, and vice versa.

@timgl
timgl temporarily deployed to posthog-pr-4949 June 30, 2021 15:44 Inactive
@EDsCODE
EDsCODE temporarily deployed to posthog-pr-4949 June 30, 2021 16:22 Inactive
@EDsCODE
EDsCODE temporarily deployed to posthog-pr-4949 June 30, 2021 16:49 Inactive
@EDsCODE
EDsCODE temporarily deployed to posthog-pr-4949 June 30, 2021 18:23 Inactive
@EDsCODE
EDsCODE temporarily deployed to posthog-pr-4949 June 30, 2021 19:04 Inactive
@EDsCODE
EDsCODE temporarily deployed to posthog-pr-4949 June 30, 2021 19:21 Inactive
@EDsCODE
EDsCODE requested review from Twixes and neilkakkar July 1, 2021 14:58
@EDsCODE
EDsCODE marked this pull request as ready for review July 1, 2021 15:14
@EDsCODE
EDsCODE temporarily deployed to posthog-pr-4949 July 1, 2021 15:15 Inactive
@EDsCODE
EDsCODE temporarily deployed to posthog-pr-4949 July 1, 2021 18:46 Inactive
@EDsCODE
EDsCODE temporarily deployed to posthog-pr-4949 July 1, 2021 20:05 Inactive

@neilkakkar neilkakkar left a comment

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.

Couple of small nits, looks good to me otherwise!

Comment thread ee/clickhouse/queries/funnels/funnel.py Outdated
Comment thread ee/clickhouse/queries/funnels/funnel.py Outdated
Comment thread ee/clickhouse/queries/breakdown_props.py Outdated
else:
return ""

def _get_breakdown_prop(self) -> str:

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.

small nit / not sure if worth tackling here since other discrepancies remain: we decided not to return query strings with a comma in the beginning.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Will save that change for a later update where we adjust how the handling is done in all this query formatting

Comment thread ee/clickhouse/queries/funnels/funnel.py
@Twixes Twixes linked an issue Jul 5, 2021 that may be closed by this pull request
}

try:
top_elements_array_result = sync_execute(query, element_params)

@Twixes Twixes Jul 6, 2021 •

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.

Radical question: could the results of this class be achieved using CTEs, so that the broken down funnel calculation is a single SQL query without a round trip?

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.

Ooh, this in interesting: Completely missed the execution at the end of both prop_values functions.

I don't see why not, sounds like a reasonable suggestion!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

unless they increased the support, but from what I remember clickhouse CTEs only allow you to use the reference in the immediate level below the CTE, so I dont think we're able to use the results of that CTE on the innermost query where we would need to do the filtering

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.

From what I've tried, they should work – though I may have missed something! I'd give this a go in any case, as even though this does not affect big-O, doing a round trip definitely is enough overhead to be degrading the experience for users.

@EDsCODE
EDsCODE temporarily deployed to posthog-pr-4949 July 6, 2021 14:22 Inactive
@EDsCODE
EDsCODE temporarily deployed to posthog-pr-4949 July 6, 2021 14:31 Inactive
@EDsCODE
EDsCODE temporarily deployed to posthog-pr-4949 July 6, 2021 14:36 Inactive
@EDsCODE
EDsCODE temporarily deployed to posthog-pr-4949 July 6, 2021 15:06 Inactive
@EDsCODE
EDsCODE temporarily deployed to posthog-pr-4949 July 6, 2021 15:16 Inactive
@EDsCODE
EDsCODE merged commit 708dcbb into master Jul 6, 2021
@EDsCODE
EDsCODE deleted the funnel-steps-breakdown branch July 6, 2021 16:37

This branch was previously deployed

1 inactive deployment
posthog-pr-4949 — e0ba67b4 Deployed Jul 6, 2021 by EDsCODE
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.

Allow breaking down in funnels

4 participants