From 5d1ea30db2e2af111bd9dfbf7ffeb3232885dd4e Mon Sep 17 00:00:00 2001
From: peter-shao <93678565+peter-shao@users.noreply.github.com>
Date: Fri, 26 Jul 2024 12:20:44 -0700
Subject: [PATCH] Error Reporting - adding session replay for web
Error Reporting will now include a new page for session replay to describe the feature for web integrations.
---
.../platform-integrations/overview.md | 1 +
.../platform-integrations/session-replay.md | 65 +++++++++++++++++++
sidebars.js | 1 +
3 files changed, 67 insertions(+)
create mode 100644 docs/error-reporting/platform-integrations/session-replay.md
diff --git a/docs/error-reporting/platform-integrations/overview.md b/docs/error-reporting/platform-integrations/overview.md
index e2c95465fd..8a7aefe3db 100644
--- a/docs/error-reporting/platform-integrations/overview.md
+++ b/docs/error-reporting/platform-integrations/overview.md
@@ -69,6 +69,7 @@ Integrate Backtrace in your games and apps across languages and platforms with o
Other Integrations
- Source Maps
+ - Session Replay
- Apache Traffic Server
- Minidump
- File Attachments
diff --git a/docs/error-reporting/platform-integrations/session-replay.md b/docs/error-reporting/platform-integrations/session-replay.md
new file mode 100644
index 0000000000..ec5de37bac
--- /dev/null
+++ b/docs/error-reporting/platform-integrations/session-replay.md
@@ -0,0 +1,65 @@
+---
+id: session-replay
+title: Session Replay for Web
+sidebar_label: Session Replay
+description: Configure session replay in your web applications.
+---
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+import useBaseUrl from '@docusaurus/useBaseUrl';
+
+:::note
+
+Session Replay is currently in beta and only available for web applications. Replays are limited during this phase.
+
+:::
+
+Session Replay allows you to capture a visual recreation of user sessions. This simplifies the replication of user errors to determine the root cause. Combining session replays with breadcrumbs and callstacks can give a complete view of the user experience.
+
+## Overview of Session Replay
+Session replay works by capturing the DOM state periodically when the user interacts wtih your application. The user session is then recreated when viewing the error in Backtrace. Unlike a video recording, these packages are lightweight and allow for additional processing prior to being sent and stored in Backtrace (i.e. masking for PII considerations). Currently, Backtrace SDK will snip the session around a triggering error, allowing your team to hone in on specific issues.
+
+The Backtrace implementation makes use of [rrweb](https://github.com/rrweb-io/rrweb/blob/master/guide.md).
+
+## Prerequisites
+- A Backtrace account ([log in](https://backtrace.io/login) or sign up for a [free trial license](https://backtrace.io/sign-up)).
+- Follow the ([JavaScript integration guide](https://docs.saucelabs.com/error-reporting/language-integrations/javascript/)).
+
+## Setting Up Session Replay
+
+### Install the package
+```bash
+ npm install @backtrace/session-replay
+```
+### Integrate the session replay module
+
+Add the following code to the build the session replay module:
+
+```javascript
+import { BacktraceClient, BacktraceConfiguration } from '@backtrace/browser';
+import { BacktraceSessionReplayModule } from '@backtrace/session-replay';
+
+// Configure client options
+const options: BacktraceConfiguration = {
+ // Name of the website/application
+ name: 'MyWebPage',
+ // Version of the website
+ version: '1.2.3',
+ // Submission url
+ // is the subdomain of your Backtrace instance (.backtrace.io)
+ // can be found in Project Settings/Submission tokens
+ url: 'https://submit.backtrace.io///json',
+};
+
+// Initialize the client with the options
+// Make sure to add `useModule` with `BacktraceSessionReplayModule`
+const client = BacktraceClient.builder(options)
+ .useModule(
+ new BacktraceSessionReplayModule({
+ maxEventCount: 100,
+ }),
+ )
+ .build();
+```
+Additional options for event limiting, masking, privacy, and more can be found on [Backtrace github](https://github.com/backtrace-labs/backtrace-javascript/tree/main/packages/session-replay).
diff --git a/sidebars.js b/sidebars.js
index b17e22eae2..bd6f86709d 100644
--- a/sidebars.js
+++ b/sidebars.js
@@ -478,6 +478,7 @@ module.exports = {
],
},
'error-reporting/platform-integrations/source-map',
+ 'error-reporting/platform-integrations/session-replay',
'error-reporting/platform-integrations/apache',
'error-reporting/platform-integrations/minidump',
'error-reporting/platform-integrations/file-attachments',