Linking events to their cause

Hey Snowplow friends! :skier:

Has any of you experience in linking events to what caused them with Snowplow?

Context
Some of our use cases require us getting data from “previous” events. For example, we want to count how many customers perform action B by clicking into a specific button in component A. For that, we are thinking to introduce an “action ID”, and propagate that into the next event such that we can link them together. I was wondering: is that supported natively in Snowplow or is this something we would need to implement ourselves?

Would love to hear your thoughts! :raised_hands:

I don’t think it’s natively supported in exactly that way but you could attach (and then detach) it as a global context when the “origin” event happens which would then allow you to see it when the “target” event occurs.

Most folks do this in the warehouse (by windowing) but there are some issues with this (e.g., if you need it on the event itself, if a user could go through multiple instances of the flow in a single session / at a time).

We have a concept of this in the new ecommerce schemas called “discovery” which is sort of this concept - only it stores the previous events of interest as an array rather than a single event.