Session Tracking

The Braze SDK reports session data that is used by the Braze dashboard to calculate user engagement and other analytics integral to understanding your users. Based on the below session semantics, our SDK generates “start session” and “close session” data points that account for session length and session counts viewable within the Braze Dashboard.

Session Lifecycle

If you have integrated Braze using our recommended Activity Lifecycle Callback Integration, openSession() and closeSession() will be called automatically for each Activity in your app. By default, sessions on Android are opened upon the first call to openSession() and are closed after an app has been out of the foreground for longer than 10 seconds. Note that calling closeSession() does not close a session immediately. Rather, it closes a session in 10 seconds if the user doesn’t call openSession() (e.g., by navigating to another Activity) in the interim.

An Android session times out after 10 seconds without any communication from the host application. This means if a user backgrounds the app and returns 9 seconds later, the same session will be continued.

Note: If a session closes while the user has the app backgrounded, that data may not be flushed to the server until the app is opened again.

Note: If you need to force a new session, you can do so by changing users.

Customizing Session Timeout

To customize the session timeout, add [com_appboy_session_timeout][session_tracking_4] to your braze.xml file:

<!-- The length of time before a session times out in seconds. The session manager will "re-open"
otherwise closed sessions if the call to StartSession comes within this interval. (default is 10) -->
<integer name="com_appboy_session_timeout">NUMBER_OF_SECONDS_UNTIL_SESSION_TIMEOUT</integer>

If you have set a session timeout, then the above session semantics all extend to that customized timeout.

Note: The minimum value for sessionTimeoutInSeconds is 1 second.

Testing Session Tracking

To detect sessions via your user, find your user on the dashboard and navigate to “App Usage” on the user profile. You can confirm that session tracking is working by checking that the “Sessions” metric increases when you would expect it to.


New Stuff!