This query is ideally used to identify the last event (for example, a ‘share’ or ‘like’), before a target event, that caused a user to reach a specific goal that interests you.
You can use the results of this query to analyze whether certain activities contributed or did not contribute to attaining a desired goal (such as a purchase). You can then change/adjust any events as needed, to increase conversion rates for your goal.
SELECT left(right(path_to_string(path), 2), 1) as event_before_subscription, count(session_internal_id) as cnt FROM cooladata WHERE date_range(doc.date_range) CLUSTER PATH BY SESSION MATH ANY ENDING WITH event_name = 'updated successfully' GROUP BY event_before_subscription ORDER BY cnt DESC
With this query, you can go back and look at a specific path of events to determine the entire path before the target event. In the sample syntax above, entering select left(right(path_to_string(path), 2), 1) as event_before_subscription, count(session_id) as cnt from cooladata, allows you to go 2 steps back, and show 1 event.