-
Notifications
You must be signed in to change notification settings - Fork 227
Description
Is your feature request related to a problem? Please describe.
We have two use cases that are based on a Snowplow session:
- Track an A/B Test experiment event - only once per session
- Tracking event sampling - sampling is calculated once per session
To implement the two use cases, we have two local storage values, where we track whether we already reported an experiment and whether a specific event action is sampled or not. OnSessionUpdateCallback
, we delete the two values, and they are re-evaluated on the next event.
The Problem is that a snowplow session is only updated on tracking events. As our logic comes first, the session is not renewed yet (if expired) and the state is as it was. This has the following impact for our use cases:
- A/B Test: No event is sent because the state still says the experiment was already reported. Even if the Snowplow session has expired and would renew now.
- Sampling: The event will be tracked if the session had sampling on. If the session has expired, it renews immediately, and the event is sent for the new session. At the same time, our state is reset, and the next tracking event reevaluates the sampling and could disable it for the session, so we will end up with only one event for the session.
Describe the solution you'd like
An exposed function, similar to newSession()
, renews the session only if it has expired. Our code could invoke this function before making a session-dependent decision or action.
Alternative: Sampling for specific events (and actions) is possible within Snowplow. This would only solve the sampling use case.
Please let us know what you think and if there is already such a logic we can use. We would also be open to a call to talk more about our use cases.