BrowserSession for Astro
Track healthy Sessions in the Browser.
This integration only works inside a browser environment.
Import name: Sentry.browserSessionIntegration
Sentry's Release Health feature allows you to track user adoption and your application's crash-free rate. When the BrowserSession integration is enabled, it automatically creates a session each time a user loads your page or application. These sessions are used to track your release health. If an error is captured during an active session, the session will be flagged as faulty. Read more about Sessions.
Copied
Sentry.init({
integrations: [Sentry.browserSessionIntegration()],
});
Sentry.init({
integrations: [Sentry.browserSessionIntegration()],
});
lifecycle
| Available since | 10.39.0 |
|---|---|
| Type | 'route' | 'page' |
| Default | 'page' |
Controls how long one session lasts and when a new session is started.
'page': Starts a session on page load. Client-side route changes keep the same session. This is the default.'route': Starts a session on page load and on each navigation detected through the History API.
Before SDK version 11, the default was 'route'.
To create a session on each client-side navigation in a single-page application, set lifecycle to 'route':
Copied
Sentry.init({
integrations: [Sentry.browserSessionIntegration({ lifecycle: "route" })],
});
Sentry.init({
integrations: [Sentry.browserSessionIntegration({ lifecycle: "route" })],
});
Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").