Adopture Docs
SDKsReact Native

Sessions

How the Adopture React Native SDK manages user sessions.

Session Lifecycle

The SDK manages sessions automatically:

  1. A new session starts when the SDK initializes
  2. Each event resets the inactivity timer
  3. After 30 minutes of inactivity, the next event starts a new session
  4. A session_start event 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:

EventWhen
session_startNew session starts (app launch or after 30 min inactivity)
app_installedFirst launch ever (no stored app version)
app_updatedFirst launch after an app version change
app_openedApp returns from background
app_backgroundedApp 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_backgrounded event is tracked (if autoCapture is 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_start event

Events are persisted to AsyncStorage, so no data is lost if the app is terminated while in the background.

On this page