Skip to content

aibrahim/BT-5870/add-session-replay-to-browser-sdk-docs #340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions packages/browser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ easy, after which you can explore the rich set of Backtrace features.
- [Attributes](#attributes)
- [File Attachments](#file-attachments)
- [Breadcrumbs](#breadcrumbs)
- [Session Replay](#session-replay)
- [Application Stability Metrics](#application-stability-metrics)
- [Metrics Configuration](#metrics-configuration)
- [Metrics Usage](#metrics-usage)
Expand Down Expand Up @@ -266,6 +267,62 @@ client.breadcrumbs?.info('This is a manual breadcrumb.', {

---

### Session Replay

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.

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.

For full details on session replay configuration, sampling, and advanced privacy controls, please see the **[Session Replay Module Documentation](../session-replay/README.md)**.

#### 1. Install the additional package

In addition to `@backtrace/browser`, you will also need to install the session replay package.

```bash
$ npm install @backtrace/session-replay
```

#### 2. Add the module to the client

To enable session replay, you must use the BacktraceClient.builder() and add the BacktraceSessionReplayModule. This replaces the standard BacktraceClient.initialize().

```ts
// Import the necessary modules
import { BacktraceClient, BacktraceConfiguration } from '@backtrace/react';
import { BacktraceSessionReplayModule } from '@backtrace/session-replay';

// Configure client options
const options: BacktraceConfiguration = {
name: 'MyWebPage',
version: '1.2.3',
url: 'https://submit.backtrace.io/<universe>/<token>/json',
};

// Initialize the client using the builder to add the session replay module
const client = BacktraceClient.builder(options)
.useModule(
new BacktraceSessionReplayModule({
// Configuration for session replay goes here.
maxEventCount: 100,
privacy: {
blockClass: 'do-not-send',
},
sampling: {
input: 'last',
}
}),
)
.build();

// The client is now initialized with Session Replay enabled.
// Any errors captured by the client or the ErrorBoundary will now include a session replay.
```

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.

---

### Application Stability Metrics

The Backtrace Browser SDK has the ability to send usage Metrics to be viewable in the Backtrace UI.
Expand Down
57 changes: 57 additions & 0 deletions packages/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ after which you can explore the rich set of Backtrace features.
- [Attributes](#attributes)
- [File Attachments](#file-attachments)
- [Breadcrumbs](#breadcrumbs)
- [Session Replay](#session-replay)
- [Application Stability Metrics](#application-stability-metrics)
- [Metrics Configuration](#metrics-configuration)
- [Metrics Usage](#metrics-usage)
Expand Down Expand Up @@ -295,6 +296,62 @@ client.breadcrumbs?.info('This is a manual breadcrumb.', {

---

### Session Replay

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.

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.

For full details on session replay configuration, sampling, and advanced privacy controls, please see the **[Session Replay Module Documentation](../session-replay/README.md)**.

#### 1. Install the additional package

In addition to `@backtrace/react`, you will also need to install the session replay package.

```bash
$ npm install @backtrace/session-replay
```

#### 2. Add the module to the client

To enable session replay, you must use the BacktraceClient.builder() and add the BacktraceSessionReplayModule. This replaces the standard BacktraceClient.initialize().

```ts
// Import the necessary modules
import { BacktraceClient, BacktraceConfiguration } from '@backtrace/react';
import { BacktraceSessionReplayModule } from '@backtrace/session-replay';

// Configure client options
const options: BacktraceConfiguration = {
name: 'MyWebPage',
version: '1.2.3',
url: 'https://submit.backtrace.io/<universe>/<token>/json',
};

// Initialize the client using the builder to add the session replay module
const client = BacktraceClient.builder(options)
.useModule(
new BacktraceSessionReplayModule({
// Configuration for session replay goes here.
maxEventCount: 100,
privacy: {
blockClass: 'do-not-send',
},
sampling: {
input: 'last',
}
}),
)
.build();

// The client is now initialized with Session Replay enabled.
// Any errors captured by the client or the ErrorBoundary will now include a session replay.
```

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.

---

### Application Stability Metrics

The Backtrace React SDK has the ability to send usage Metrics to be viewable in the Backtrace UI.
Expand Down