SDKsReact Native
Sessions
How the Adopture React Native SDK manages user sessions.
Session Lifecycle
The SDK manages sessions automatically:
- A new session starts when the SDK initializes
- Each event resets the inactivity timer
- After 30 minutes of inactivity, the next event starts a new session
- A
session_startevent is automatically tracked when a new session begins
No configuration is needed — sessions work out of the box.
Session ID
Each session has a unique UUID. Access it via:
const sessionId = Adopture.sessionId;The session ID is included with every event automatically.
Session Events
When autoCapture is enabled (default), the SDK tracks these events automatically:
| Event | When |
|---|---|
session_start | New session starts (app launch or after 30 min inactivity) |
app_installed | First launch ever (no stored app version) |
app_updated | First launch after an app version change |
app_opened | App returns from background |
app_backgrounded | App enters background |
Force a New Session
To manually start a new session:
await Adopture.reset();This clears the current session, user identity, and event queue, then starts a fresh session.
Background Behavior
When the app goes to the background:
- An
app_backgroundedevent is tracked (ifautoCaptureis enabled) - The inactivity timer continues running
- If the app returns within 30 minutes, the same session continues
- If the app returns after 30 minutes, a new session starts with a
session_startevent
Events are persisted to AsyncStorage, so no data is lost if the app is terminated while in the background.