RudderStack passes the event's
timestamp (in milliseconds) as the
RudderStack does not attach any user information to the
sessionId. This is so that a user cannot be traced back or identified only with the
If you call the
startSession() API while automatic session tracking is enabled, RudderStack ends the existing session and starts a new session. Also, it disables automatic session tracking.
If you call the
reset()API, RudderStack ends the existing session and generates a new one.
RudderStack currently supports session tracking only for the following events:
If you manually trigger a session using the
startSession() API, RudderStack will disable automatic session tracking only till the app is closed.
RudderStack will end the active session and generate a new session.
If you set the session's
timeout to 0, RudderStack disables automatic session tracking. This is because upon setting the
timeout to 0, RudderStack creates a new session for each event. As such, enabling automatic session tracking serves no purpose.
If your session
timeout is less than 10 ms, RudderStack gives a caution but proceeds with the session tracking.
RudderStack persists the following session tracking-related information in local storage/cookie in a new field called
|String||Uniquely identifies a session.|
|Session expiration time||Number||Time when the session expires. RudderStack calculates it as the last event's |
|Manual session tracking status||Boolean||-|
|Automatic session tracking status||Boolean||-|
|Session started||Boolean||A flag that identifies the first event of the session.|
If the time between closing the tab and reopening it is less than the session timeout (default is 30 minutes), then RudderStack continues the same session. Otherwise, it starts a new session.
When an application is closed completely and launched from scratch, RudderStack checks if the inactivity timeout of the previous automatically tracked session has elapsed. If yes, RudderStack creates a new session, otherwise it continues the previous session.
What is the scope of persistence in case of manual session tracking?
The scope of manual session tracking depends on whether the automatic session tracking feature is enabled.
- If automatic session tracking is enabled: On the next app launch (from scratch), RudderStack clears the manual session even if
endSession()is not called and generates a new automatic session.
- If automatic session tracking is disabled: On the next app launch, the manual session will still be active and cleared only when the user ends the session using
RudderStack stores the
sessionId, the last event timestamp (used to determine session expiration), and the status of automatic session tracking in the following locations: