Objective
This article explains how the AmplitudeSessionPlugin for Segment’s React Native SDK manages session_start and session_end events. It describes the session timeout logic, event emission timing, and the 5-minute inactivity rule, helping you understand the plugin’s expected behavior.
Product
Twilio Segment
Environment
Segment Console
User Account Permission/Role(s) Required
N/A
Procedure
-
Session Timeout Logic
- The AmplitudeSessionPlugin tracks user sessions based on app activity.
- A session remains active until there are 5 minutes (300,000 ms) of inactivity.
-
Session Event Emission
- On first app launch, a session_start event is triggered.
- If the app is backgrounded or killed, the plugin records the timestamp of the last event.
- When the app is relaunched after more than 5 minutes of inactivity:
- The plugin emits a session_end event (timestamped at the last activity, not at relaunch).
- A new session_start event is triggered for the new session.
- If the app is relaunched within 5 minutes, the previous session continues and no new session_start or session_end event is emitted.
-
Event Timing Details
- The session_end event is dated to the last activity, not the time of app relaunch.
- A new session only starts if no events are sent for 5 minutes. Any event sent during that period continues the current session.
Additional Information
- The plugin’s session management logic is based on inactivity, not app process state.
- For more details, refer to: