Calculating events that lead up to another event using Clickhouse

Viewed 43

Hi everyone and I new to complex SQL and to Clickhouse both. So sorry if this seems like a simple question, but I still can't figure it out.

Challenge: I want to build an event path that leads to a specific event.

You probably have seen these types of analysis in Google Analytics, for instance:

Reverse Path Analysis

Basically, based on a target "end event", I am looking to build the path taken by the user to arrive at that event.

Suppose I have a table like this:

  • date
  • event_name (purchase, add_to_cart, search, browse)
  • user_id

Now, given the final event, let's say "purchase", I want to understand what are the common paths for users to arrive at that event, just like the picture above.

How would you go about accomplishing that?

I am using Clickhouse for this analysis.

Thanks

0 Answers
Related