Skip to content

Commit 594c7e8

Browse files
authored
docs(replay): Add CDN bundle instructions to README (#6431)
Add a subsection about CDN bundle installation and usage. The only thing that's different in this doc compared to a normal integration CDN bundle doc on [Sentry docs](https://docs.sentry.io/platforms/javascript/install/cdn/#available-bundles) is that I can't specify the `integrity` attribute in the script tag because we can't automatically get the correct checksum in the Readme. I opted to leave it out and add a sentence that links people to our CDN bundle checksum table.
1 parent 591f9cb commit 594c7e8

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

packages/replay/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Make sure to use the exact same version of `@sentry/replay` as your other Sentry
2222

2323
## Installation
2424

25+
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).
26+
2527
with npm:
2628

2729
```shell
@@ -87,6 +89,45 @@ replay.start(); // Start recording
8789
replay.stop(); // Stop recording
8890
```
8991

92+
## Loading Replay as a CDN Bundle
93+
94+
As an alternative to the NPM package, you can load the Replay integration bundle from our CDN.
95+
Note that the Replay bundle **only contains the Replay integration** and not the entire Sentry SDK.
96+
You have to add it in addition to the Sentry Browser SDK bundle:
97+
98+
```js
99+
// Browser SDK bundle
100+
<script
101+
src="https://browser.sentry-cdn.com/7.24.0/bundle.tracing.min.js"
102+
crossorigin="anonymous"
103+
></script>
104+
105+
// Replay integration bundle
106+
<script
107+
src="https://browser.sentry-cdn.com/7.24.0/replay.min.js"
108+
crossorigin="anonymous"
109+
></script>
110+
111+
// Add Sentry.Integrations.Replay to your Sentry.init call
112+
Sentry.init({
113+
// This sets the sample rate to be 10%. You may want this to be 100% while
114+
// in development and sample at a lower rate in production
115+
replaysSessionSampleRate: 0.1,
116+
117+
// If the entire session is not sampled, use the below sample rate to sample
118+
// sessions when an error occurs.
119+
replaysOnErrorSampleRate: 1.0,
120+
121+
dsn: '__DSN__',
122+
integrations: [new Sentry.Integrations.Replay()],
123+
});
124+
```
125+
126+
The Replay initilialization [configuration](#configuration) options are identical to the options of the NPM package.
127+
128+
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.
129+
Note that the two bundle versions always have to match.
130+
90131
## Sessions
91132

92133
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).

0 commit comments

Comments
 (0)