Fix session resumption when changing storage strategy with disableAnonymousTracking#1433
Merged
Jethro Nederhof (jethron) merged 1 commit intosnowplow:release/4.6.3from May 27, 2025
Conversation
6987961 to
b495fa1
Compare
Matus Tomlein (matus-tomlein)
approved these changes
May 26, 2025
Contributor
Matus Tomlein (matus-tomlein)
left a comment
There was a problem hiding this comment.
LGTM!
0e162b1
into
snowplow:release/4.6.3
1 check failed
Merged
Matus Tomlein (matus-tomlein)
pushed a commit
that referenced
this pull request
May 29, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If you create a tracker in anonymousTracking mode with session tracking enabled, and then change the storage strategy when disabling anonymousTracking mode, the tracker looks for the
sescookie using the new strategy rather than the old one, which fails. This makes it think a new session has begun. In order to tie the anonymous behaviour to the non-anonymous behaviour, you have to stitch via pageview ID or network user ID rather than the expected session ID.If this is the initial pageview, this can cause interesting cases like events from a single pageview with two different
domain_sessionidvalues, both withdomain_sessionidx= 1.With this change, we detect when a storage strategy is being changed, and if we are already in a session with the old strategy, update the
sescookie with the new strategy before loading the ID. This allows the tracker to notice a session is already in progress with the new strategy, and resume it with the existing session ID/index.If there is no change to the storage strategy, or there is currently no session in progress, the behavior remains unchanged.
E.g.