Skip to content

Commit 52aba15

Browse files
author
Ahmad Ibrahim
committed
error-reporting/backtrace-javascript, react-native: add session replay section to readme
1 parent ff10944 commit 52aba15

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

packages/react-native/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and easy, after which you can explore the rich set of Backtrace features.
1616
- [Attributes](#attributes)
1717
- [File Attachments](#file-attachments)
1818
- [Breadcrumbs](#breadcrumbs)
19+
- [Session Replay](#session-replay)
1920
- [Application Stability Metrics](#application-stability-metrics)
2021
- [Metrics Configuration](#metrics-configuration)
2122
- [Metrics Usage](#metrics-usage)
@@ -267,6 +268,62 @@ client.breadcrumbs?.info('This is a manual breadcrumb.', {
267268

268269
---
269270

271+
### Session Replay
272+
273+
The optional `@backtrace/session-replay` module allows you to capture and replay the user's interactions leading up to an error. This provides a video-like context for your error reports, making it much easier to reproduce and debug issues.
274+
275+
The Session Replay module is designed with privacy as a top priority. By default, it automatically masks all text and input fields to avoid capturing sensitive user data.
276+
277+
For full details on session replay configuration, sampling, and advanced privacy controls, please see the **[Session Replay Module Documentation](../session-replay/README.md)**.
278+
279+
#### 1. Install the additional package
280+
281+
In addition to `@backtrace/react-native`, you will also need to install the session replay package.
282+
283+
```bash
284+
$ npm install @backtrace/session-replay
285+
```
286+
287+
#### 2. Add the module to the client
288+
289+
To enable session replay, you must use the BacktraceClient.builder() and add the BacktraceSessionReplayModule. This replaces the standard BacktraceClient.initialize().
290+
291+
```ts
292+
// Import the necessary modules
293+
import { BacktraceClient, BacktraceConfiguration } from '@backtrace/react-native';
294+
import { BacktraceSessionReplayModule } from '@backtrace/session-replay';
295+
296+
// Configure client options
297+
const options: BacktraceConfiguration = {
298+
name: 'MyWebPage',
299+
version: '1.2.3',
300+
url: 'https://submit.backtrace.io/<universe>/<token>/json',
301+
};
302+
303+
// Initialize the client using the builder to add the session replay module
304+
const client = BacktraceClient.builder(options)
305+
.useModule(
306+
new BacktraceSessionReplayModule({
307+
// Configuration for session replay goes here.
308+
maxEventCount: 100,
309+
privacy: {
310+
blockClass: 'do-not-send',
311+
},
312+
sampling: {
313+
input: 'last',
314+
}
315+
}),
316+
)
317+
.build();
318+
319+
// The client is now initialized with Session Replay enabled.
320+
// Any errors captured by the client or the ErrorBoundary will now include a session replay.
321+
```
322+
323+
When an error is captured, a link to the session replay will be available on the Debugger page for that specific error in the Backtrace UI.
324+
325+
---
326+
270327
### Application Stability Metrics
271328

272329
The Backtrace react-native SDK has the ability to send usage Metrics to be viewable in the Backtrace UI.

0 commit comments

Comments
 (0)