Skip to content

Commit 9130eae

Browse files
committed
docs(replay): Update replay README
1 parent 682efa5 commit 9130eae

File tree

1 file changed

+45
-23
lines changed

1 file changed

+45
-23
lines changed

packages/replay/README.md

Lines changed: 45 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,21 @@ import { Replay } from '@sentry/replay';
3434

3535
Sentry.init({
3636
dsn: '__DSN__',
37+
38+
// This sets the sample rate to be 10%. You may want this to be 100% while
39+
// in development and sample at a lower rate in production
40+
replaysSampleRate: 0.5,
41+
42+
// If the entire session is not sampled, use the below sample rate to sample
43+
// sessions when an error occurs.
44+
replaysOnErrorSampleRate: 1.0,
45+
3746
integrations: [
3847
new Replay({
39-
// This sets the sample rate to be 10%. You may want this to be 100% while
40-
// in development and sample at a lower rate in production
41-
sessionSampleRate: 0.1,
42-
43-
// If the entire session is not sampled, use the below sample rate to sample
44-
// sessions when an error occurs.
45-
errorSampleRate: 1.0,
46-
47-
// Mask all text content with asterisks (*). Passes text
48-
// content through to `maskTextFn` before sending to server.
49-
//
50-
// Defaults to true, uncomment to change
51-
// maskAllText: true,
52-
53-
// Block all media elements (img, svg, video, object,
54-
// picture, embed, map, audio)
55-
//
56-
// Defaults to true, uncomment to change
57-
// blockAllMedia: true,
48+
// Additional SDK configuration goes in here, for example:
49+
maskAllText: true,
50+
blockAllMedia: true
51+
// See below for all available options
5852
})
5953
],
6054
// ...
@@ -104,16 +98,29 @@ Sampling occurs when the session is first started. `sessionSampleRate` is evalua
10498

10599
## Configuration
106100

107-
### General Configuration
101+
### SDK Configuration
102+
103+
The following options can be configured on the root level of your browser-based Sentry SDK, in `init({})`:
104+
105+
106+
| key | type | default | description |
107+
| ------------------- | ------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
108+
| replaysSampleRate | number | `0.1` | The sample rate for all sessions, which will capture the entirety from when a user begins a session until the session ends. (1.0 will collect all replays, 0 will collect no replays) |
109+
| replaysOnErrorSampleRate | number | `1.0` | If a session isn't already being recorded via `replaysSampleRate`, based on `replaysOnErrorSampleRate` the SDK will send the captured replay when an error occurs. (1.0 capturing all sessions with an error, and 0 capturing none).
110+
111+
### General Integration Configuration
112+
113+
The following options can be configured as options to the integration, in `new Replay({})`:
108114

109115
| key | type | default | description |
110116
| ------------------- | ------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
111-
| sessionSampleRate | number | `0.1` | The sample rate for all sessions, which will capture the entirety from when a user begins a session until the session ends. (1.0 will collect all replays, 0 will collect no replays) |
112-
| errorSampleRate | number | `1.0` | If a session isn't already being recorded via `sessionSampleRate`, based on `errorSampleRate` the SDK will send the captured replay when an error occurs. (1.0 capturing all sessions with an error, and 0 capturing none). |
113117
| stickySession | boolean | `true` | Keep track of the user across page loads. Note a single user using multiple tabs will result in multiple sessions. Closing a tab will result in the session being closed as well. |
114118

119+
115120
### Privacy Configuration
116121

122+
The following options can be configured as options to the integration, in `new Replay({})`:
123+
117124
| key | type | default | description |
118125
| ---------------- | ------------------------ | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
119126
| maskAllText | boolean | `true` | Mask _all_ text content. Will pass text content through `maskTextFn` before sending to server. |
@@ -126,16 +133,31 @@ Sampling occurs when the session is first started. `sessionSampleRate` is evalua
126133
| blockSelector | string | `'[data-sentry-block]'` | Redact all elements that match the DOM selector. See [privacy](#blocking) section for an example. |
127134
| ignoreClass | string \| RegExp | `'sentry-ignore'` | Ignores all events on the matching input field. See [privacy](#ignoring) section for an example. |
128135
| maskTextClass | string \| RegExp | `'sentry-mask'` | Mask all elements that match the class name. See [privacy](#masking) section for an example. |
136+
| maskTextSelector | string | `undefined` | Mask all elements that match the given DOM selector. See [privacy](#masking) section for an example. |
129137

130138
### Optimization Configuration
131139

140+
The following options can be configured as options to the integration, in `new Replay({})`:
141+
132142
| key | type | default | description |
133143
| ---------------- | ----------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
134144
| collectFonts | boolean | `false` | Should collect fonts used on the website |
135145
| inlineImages | boolean | `false` | Should inline `<image>` content |
136146
| inlineStylesheet | boolean | `true` | Should inline stylesheets used in the recording |
137147
| recordCanvas | boolean | `false` | Should record `<canvas>` elements |
138-
| slimDOMOptions | Record<string, boolean> | `{}` | Remove unnecessary parts of the DOM <br /> Available keys: `script, comment, headFavicon, headWhitespace, headMetaDescKeywords, headMetaSocial, headMetaRobots, headMetaHttpEquiv, headMetaAuthorship, headMetaVerification` |
148+
149+
150+
### rrweb Configuration
151+
152+
In addition to the options described above, you can also directly pass configuration to [rrweb](https://github.com/rrweb-io/rrweb/blob/rrweb%401.1.3/guide.md), which is the underlying library used to make the recordings:
153+
154+
```js
155+
new Replay({
156+
157+
// any further configuration here is passed directly to rrweb
158+
});
159+
```
160+
139161

140162
## Privacy
141163
There are several ways to deal with PII. By default, the integration will mask all text content with `*` and block all media elements (`img, svg, video, object, picture, embed, map, audio`). This can be disabled by setting `maskAllText` to `false`. It is also possible to add the following CSS classes to specific DOM elements to prevent recording its contents: `sentry-block`, `sentry-ignore`, and `sentry-mask`. The following sections will show examples of how content is handled by the differing methods.

0 commit comments

Comments
 (0)