Skip to content

Tracking Sessions

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

Session lifecycle

By default, sessions begin when braze.openSession() is first called and remain open until at least 30 minutes of inactivity. This means that if the user navigates away from the site and returns less than 30 minutes later, the same session will continue. If they return after the 30 minutes have expired, a “close session” data point is automatically generated for the time they navigated away, and a new session opens.

Customizing session timeout

To customize the session timeout, pass the sessionTimeoutInSeconds option to your initialize function. The minimum value for sessionTimeoutInSeconds is 1 second.

1
2
// Sets the session timeout to 15 minutes instead of the default 30
braze.initialize('YOUR-API-KEY-HERE', { sessionTimeoutInSeconds: 900 });

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

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 session metric increases when you would expect it to.

A user profile component showing how many sessions have occurred, when the app was first used, and when it was last used.

HOW HELPFUL WAS THIS PAGE?
New Stuff!