Skip to content

Commit 7d2054e

Browse files
author
Ahmad Ibrahim
committed
error-reporting/backtrace-javascript, browser: add session replay section to readme
1 parent 93a5266 commit 7d2054e

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

packages/browser/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ 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)
@@ -266,6 +267,62 @@ client.breadcrumbs?.info('This is a manual breadcrumb.', {
266267

267268
---
268269

270+
### Session Replay
271+
272+
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.
273+
274+
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.
275+
276+
For full details on session replay configuration, sampling, and advanced privacy controls, please see the **[Session Replay Module Documentation](../session-replay/README.md)**.
277+
278+
#### 1. Install the additional package
279+
280+
In addition to `@backtrace/browser`, you will also need to install the session replay package.
281+
282+
```bash
283+
$ npm install @backtrace/session-replay
284+
```
285+
286+
#### 2. Add the module to the client
287+
288+
To enable session replay, you must use the BacktraceClient.builder() and add the BacktraceSessionReplayModule. This replaces the standard BacktraceClient.initialize().
289+
290+
```ts
291+
// Import the necessary modules
292+
import { BacktraceClient, BacktraceConfiguration } from '@backtrace/react';
293+
import { BacktraceSessionReplayModule } from '@backtrace/session-replay';
294+
295+
// Configure client options
296+
const options: BacktraceConfiguration = {
297+
name: 'MyWebPage',
298+
version: '1.2.3',
299+
url: 'https://submit.backtrace.io/<universe>/<token>/json',
300+
};
301+
302+
// Initialize the client using the builder to add the session replay module
303+
const client = BacktraceClient.builder(options)
304+
.useModule(
305+
new BacktraceSessionReplayModule({
306+
// Configuration for session replay goes here.
307+
maxEventCount: 100,
308+
privacy: {
309+
blockClass: 'do-not-send',
310+
},
311+
sampling: {
312+
input: 'last',
313+
}
314+
}),
315+
)
316+
.build();
317+
318+
// The client is now initialized with Session Replay enabled.
319+
// Any errors captured by the client or the ErrorBoundary will now include a session replay.
320+
```
321+
322+
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.
323+
324+
---
325+
269326
### Application Stability Metrics
270327

271328
The Backtrace Browser SDK has the ability to send usage Metrics to be viewable in the Backtrace UI.

0 commit comments

Comments
 (0)