You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We somewhat recently migrated from the JavaScript SDK to v2 browser SDK and immediately noticed our average session lengths blow up across the board (from about an an average of 11m / session to over 4 hours). Upon closer inspection, we noticed that events were no longer being grouped together correctly into sessions – events that happened hours apart are being grouped together into the same session (same session ID), while events that should have the same session ID, don't.
Current Behavior
Something seems to be wrong with the session timeout managed by the v2.0 browser SDK.
See an example below:
8 events all happened within a minute of each other (on Feb 20th at 7.46pm), the first of which was a sign in user event (this is commonly the first event recorded in a session for our app). However, the sign in event has a different session ID than the rest of the events, so it's actually grouped under a different session.
Then, at 6.41pm on Feb 27th seven days later, another sign in user event is triggered – yet somehow, it gets the same session ID as the events that happened on Feb 20th. This gives this particular session a session length of over 7 days, which is clearly wrong.
Possible Solution
We're not really sure what's going on here. When we were using the JavaScript SDK we didn't have this problem, and nothing has changed in the way we've configured the two SDKs. See below for our configuration of the v2.0 browser SDK ("@amplitude/analytics-browser": "^2.3.7"):
Note that we have session event tracking disabled, but we originally had it enabled and that didn't seem to matter for this particular bug. We don't want Amplitude to track session start/end events, but that's shouldn't affect its ability to create session IDs and group events into sessions, from our understanding?
Prior to the v2.0 migration, this is how we configured the JavaScript SDK ("amplitude-js": "^8.2.0"):
@ifbarrera thanks for creating this issue. Can you please share the URL to a sample user that is running into this problem so I can take a closer look?
Synced offline @ifbarrera. The issue was that the page was fetching the session id before amplitude was initialized and was being passed to the server for server side event tracking. Since amplitude was not initialized yet, fetching the session id returned the previous session id and not the new one. Hence server side events were tied to the old session and not the new session.
Expected Behavior
We somewhat recently migrated from the JavaScript SDK to v2 browser SDK and immediately noticed our average session lengths blow up across the board (from about an an average of 11m / session to over 4 hours). Upon closer inspection, we noticed that events were no longer being grouped together correctly into sessions – events that happened hours apart are being grouped together into the same session (same session ID), while events that should have the same session ID, don't.
Current Behavior
Something seems to be wrong with the session timeout managed by the v2.0 browser SDK.
See an example below:
sign in user
event (this is commonly the first event recorded in a session for our app). However, the sign in event has a different session ID than the rest of the events, so it's actually grouped under a different session.Possible Solution
We're not really sure what's going on here. When we were using the JavaScript SDK we didn't have this problem, and nothing has changed in the way we've configured the two SDKs. See below for our configuration of the v2.0 browser SDK (
"@amplitude/analytics-browser": "^2.3.7"
):Note that we have session event tracking disabled, but we originally had it enabled and that didn't seem to matter for this particular bug. We don't want Amplitude to track session start/end events, but that's shouldn't affect its ability to create session IDs and group events into sessions, from our understanding?
Prior to the v2.0 migration, this is how we configured the JavaScript SDK (
"amplitude-js": "^8.2.0"
):Steps to Reproduce
Not really sure how to reproduce, it happens for most of our sessions.
Environment
"@amplitude/analytics-browser": "^2.3.7"
npm install
Happy to share more examples if it's helpful. Thank you!
The text was updated successfully, but these errors were encountered: