Skip to content

docs(replay): Add CDN bundle instructions to README #6431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions packages/replay/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Make sure to use the exact same version of `@sentry/replay` as your other Sentry

## Installation

Install the Replay package with NPM or your favourite package manager. Alternatively, you can load the Replay integration via a [CDN bundle](#loading-replay-as-a-cdn-bundle).

with npm:

```shell
Expand Down Expand Up @@ -87,6 +89,45 @@ replay.start(); // Start recording
replay.stop(); // Stop recording
```

## Loading Replay as a CDN Bundle

As an alternative to the NPM package, you can load the Replay integration bundle from our CDN.
Note that the Replay bundle **only contains the Replay integration** and not the entire Sentry SDK.
You have to add it in addition to the Sentry Browser SDK bundle:

```js
// Browser SDK bundle
<script
src="https://browser.sentry-cdn.com/7.24.0/bundle.tracing.min.js"
crossorigin="anonymous"
></script>

// Replay integration bundle
<script
src="https://browser.sentry-cdn.com/7.24.0/replay.min.js"
crossorigin="anonymous"
></script>

// Add Sentry.Integrations.Replay to your Sentry.init call
Sentry.init({
// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,

// If the entire session is not sampled, use the below sample rate to sample
// sessions when an error occurs.
replaysOnErrorSampleRate: 1.0,

dsn: '__DSN__',
integrations: [new Sentry.Integrations.Replay()],
});
```

The Replay initilialization [configuration](#configuration) options are identical to the options of the NPM package.

Please visit our [CDN bundle docs](https://docs.sentry.io/platforms/javascript/install/cdn/#available-bundles) to get the correct `integrity` checksums for your version.
Note that the two bundle versions always have to match.

## Sessions

A session starts when the Session Replay SDK is first loaded and initialized. The session will continue until 5 minutes passes without any user interactions[^1] with the application *OR* until a maximum of 30 minutes have elapsed. Closing the browser tab will end the session immediately according to the rules for [SessionStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage).
Expand Down