Hello, I was wondering how to enable automatic ses...
# support
c
Hello, I was wondering how to enable automatic session tracking on javascript? I thought it would just start recording the session id under the context object when it became available but that doesn't seem to be the case. Can someone help me get this enabled?
q
https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-javascript-sdk/load-js-sdk/#tracking-user-sessions By default, the JavaScript SDK automatically tracks the user sessions. This means that RudderStack automatically determines the start and end of a user session depending on the inactivity time configured in the SDK (default time is 30 minutes).
Copy code
rudderanalytics.load(WRITE_KEY, DATA_PLANE_URL, {
  sessions: {
    autoTrack: true,
    timeout: 10 * 60 * 1000,  // 10 min in milliseconds
  },
  ...<otherLoadOptions>
});
c
Thank you, not sure how i missed this. If we want to just use the default setting for timeout then we just omit it from the code right?
When we added the session option to the js snippet we are not seeing the sessionid or sessionStart properties appear in the context object on our events. What could be causing this?
We do not call the startsession() API at any time which would disable auto session tracking
@adamant-motherboard-98897 Hey Eric, I was wondering if you could potentially help me out here.
h
It works for me, can you show an example of your destination live events
c
Do you mean what the events look like in the live event stream in rudderstack? Or in Snowflake? Either way, no session properties are anywhere to be found. Here is a screenshot of the implementation code:
h
looks correct - what version of the sdk?
c
"rudder-sdk-js": "^2.12.2" Does that not meet the minimum requirement? It's sort of confusing on the doc page.
h
Yeah sessions was only a thing in December if I recall correctly - 2.12.2 looks like 5/6 months old
c
Got it. Okay this makes sense
Updated the version and it worked 🤦
h
Great 👏