Skip to content

Commit b8e2349

Browse files
krystofwoldrichbitsandfoxes
authored andcommitted
feat(react-native): Add Browser replay init to the RN docs (#13233)
1 parent 66260df commit b8e2349

File tree

1 file changed

+40
-3
lines changed
  • docs/platforms/react-native/session-replay

1 file changed

+40
-3
lines changed

docs/platforms/react-native/session-replay/index.mdx

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pnpm add @sentry/react-native
3333

3434
To set up the integration, add the following to your Sentry initialization.
3535

36-
```javascript
36+
```javascript {tabTitle:Mobile}
3737
import * as Sentry from "@sentry/react-native";
3838

3939
Sentry.init({
@@ -47,6 +47,24 @@ Sentry.init({
4747
});
4848
```
4949

50+
```javascript {tabTitle:Browser}
51+
import * as Sentry from '@sentry/react-native';
52+
import { Platform } from 'react-native';
53+
54+
Sentry.init({
55+
dsn: "___PUBLIC_DSN___",
56+
replaysSessionSampleRate: 0.1,
57+
replaysOnErrorSampleRate: 1.0,
58+
integrations: (integrations) => {
59+
if (Platform.OS === 'web') {
60+
integrations.push(Sentry.browserReplayIntegration());
61+
}
62+
integrations.push(Sentry.mobileReplayIntegration());
63+
return integrations;
64+
},
65+
});
66+
```
67+
5068
## Verify
5169

5270
While you're testing, we recommend that you set <PlatformIdentifier name="replays-session-sample-rate" /> to `1.0`. This ensures that every user session will be sent to Sentry.
@@ -79,9 +97,9 @@ If you encounter any data not being redacted with the default settings, please l
7997

8098
To disable redaction altogether (not to be used on applications with sensitive data):
8199

82-
```javascript
83-
// You can pass options to the mobileReplayIntegration function during init:
100+
```javascript {tabTitle:Mobile}
84101
integrations: [
102+
// You can pass options to the mobileReplayIntegration function during init:
85103
Sentry.mobileReplayIntegration({
86104
maskAllText: false,
87105
maskAllImages: false,
@@ -90,6 +108,25 @@ integrations: [
90108
]
91109
```
92110

111+
```javascript {tabTitle:Browser}
112+
integrations: (integrations) => {
113+
if (Platform.OS === 'web') {
114+
// You can pass options to the browserReplayIntegration function during init:
115+
integrations.push(Sentry.browserReplayIntegration({
116+
maskAllText: true,
117+
maskAllInputs: true,
118+
}));
119+
}
120+
// You can pass options to the mobileReplayIntegration function during init:
121+
integrations.push(Sentry.mobileReplayIntegration({
122+
maskAllText: false,
123+
maskAllImages: false,
124+
maskAllVectors: false,
125+
}));
126+
return integrations;
127+
}
128+
```
129+
93130
## React Component Names
94131

95132
Sentry helps you capture your React components and unlock additional insights in your application. You can set it up to use React component names.

0 commit comments

Comments
 (0)