openreplay/tracker/tracker-assist
Delirium 960da9f037
Tracker 14.x.x changes (#2240)
* feat tracker: add document titles to tabs

* feat: titles for tabs

* feat tracker: send initial title, parse titles better

* feat ui: tab name styles

* feat tracker: update changelogs

* fix tracker: fix tests

* fix tracker: fix failing tests, add some coverage

* fix tracker: fix failing tests, add some coverage

* Heatmaps  (#2264)

* feat ui: start heatmaps ui and tracker update

* fix ui: drop clickmap from session

* fix ui: refactor heatmap painter

* fix ui: store click coords as int percent

* feat(backend): insert normalized x and y to PG

* feat(backend): insert normalized x and y to CH

* feat(connector): added missing import

* feat(backend): fixed different uint type issue

* fix tracker: use max scrollable size for doc

* fix gen files

* fix ui: fix random crash, remove demo data generator

* fix ui: rm some dead code

---------

Co-authored-by: Alexander <zavorotynskiy@pm.me>

* fix tracker: add heatmap changelog to tracker CHANGELOG.md

* fix tracker: fix peerjs version to 1.5.4 (was 1.5.1)

* fix document height calculation

* Crossdomain tracking (#2277)

* feat tracker: crossdomain tracking (start commit)

* catch crossdomain messages, add nodeid placeholder

* click scroll

* frame placeholder number -> dynamic

* click rewriter, fix scroll prop

* some docs

* some docs

* fix options merging

* CHANGELOG.md update

* checking that crossdomain will not fire automatically

* simplify func declaration

* update test data

* change clickmap document height calculation to scrollheight (which should be true height)

---------

Co-authored-by: Alexander <zavorotynskiy@pm.me>
2024-06-24 13:49:26 +02:00
..
layout change(tracker): change html layout 2022-10-21 11:26:00 +02:00
src fix ui: fixes for permissions in assist and devtools 2024-05-28 17:22:29 +02:00
tests fix(tracker): fix asist canvas layer (#1923) 2024-03-01 12:08:50 +01:00
.eslintignore fix(tracker): fix eslint ignore 2023-06-09 11:41:59 +02:00
.eslintrc.cjs feat(ui/tracker/player): handle multiple callers in one assist session 2022-08-09 13:32:20 +03:00
.gitignore feat(tracker/ui): support for multi tab sessions (#1236) 2023-06-07 10:40:32 +02:00
.npmignore feat(assist): 3.5.0: transition to WS, remote control separation + better customize configuration 2022-02-10 23:51:32 +01:00
bun.lockb Tracker 14.x.x changes (#2240) 2024-06-24 13:49:26 +02:00
CHANGELOG.md fix ui: fixes for permissions in assist and devtools 2024-05-28 17:22:29 +02:00
jest.config.js feat(tracker/ui): support for multi tab sessions (#1236) 2023-06-07 10:40:32 +02:00
LICENSE MIT license for OpenReplay protocol 2022-08-30 19:04:32 +02:00
package.json Tracker 14.x.x changes (#2240) 2024-06-24 13:49:26 +02:00
pkgver.sh chore(tracker): fix assist build and version ingestion 2023-10-27 17:00:47 +02:00
README.md fix(ui): onboarding design fixes (#1993) 2024-03-25 16:27:51 +01:00
tsconfig-cjs.json feat(tracker/ui): support for multi tab sessions (#1236) 2023-06-07 10:40:32 +02:00
tsconfig.json feat(tracker/ui): support for multi tab sessions (#1236) 2023-06-07 10:40:32 +02:00

OpenReplay Assist

OpenReplay Assist Plugin allows you to support your users by seeing their live screen and instantly hopping on call (WebRTC) with them without requiring any 3rd-party screen sharing software.

Documentation

For launch options and available public methods, refer to the documentation

Installation

npm i @openreplay/tracker-assist

OR

yarn add @openreplay/tracker-assist

Usage

With NPM

Initialize the tracker then load the @openreplay/tracker-assist plugin.

If your website is a Single Page Application (SPA)

import Tracker from '@openreplay/tracker';
import trackerAssist from '@openreplay/tracker-assist';

const tracker = new Tracker({
  projectKey: PROJECT_KEY,
});
tracker.use(trackerAssist(options)); // check the list of available options below

tracker.start();

If your web app is Server-Side-Rendered (SSR)

Follow the below example if your app is SSR. Ensure tracker.start() is called once the app is started (in useEffect or componentDidMount).

import OpenReplay from '@openreplay/tracker/cjs';
import trackerFetch from '@openreplay/tracker-assist/cjs';

const tracker = new OpenReplay({
  projectKey: PROJECT_KEY
});
tracker.use(trackerAssist(options)); // check the list of available options below

//...
function MyApp() {
  useEffect(() => { // use componentDidMount in case of React Class Component
    tracker.start();
  }, [])
//...
}

Options

trackerAssist({
  onAgentConnect: StartEndCallback;
  onCallStart: StartEndCallback;
  onRemoteControlStart: StartEndCallback;
  onRecordingRequest?: (agentInfo: Record<string, any>) => any;
  onCallDeny?: () => any;
  onRemoteControlDeny?: (agentInfo: Record<string, any>) => any;
  onRecordingDeny?: (agentInfo: Record<string, any>) => any;
  session_calling_peer_key: string;
  session_control_peer_key: string;
  callConfirm: ConfirmOptions;
  controlConfirm: ConfirmOptions;
  recordingConfirm: ConfirmOptions;
  socketHost?: string;
  config: RTCConfiguration;
  serverURL: string
  callUITemplate?: string;
})
type ConfirmOptions = {
  text?:string,
  style?: StyleObject, // style object (i.e {color: 'red', borderRadius: '10px'})
  confirmBtn?: ButtonOptions,
  declineBtn?: ButtonOptions
}

type ButtonOptions = HTMLButtonElement | string | {
  innerHTML?: string, // to pass an svg string or text
  style?: StyleObject, // style object (i.e {color: 'red', borderRadius: '10px'})
}
  • callConfirm: Customize the text and/or layout of the call request popup.
  • controlConfirm: Customize the text and/or layout of the remote control request popup.
  • config: Contains any custom ICE/TURN server configuration. Defaults to { 'iceServers': [{ 'urls': 'stun:stun.l.google.com:19302' }], 'sdpSemantics': 'unified-plan' }.
  • onAgentConnect: () => (()=>void | void): This callback function is fired when someone from OpenReplay UI connects to the current live session. It can return another function. In this case, returned callback will be called when the same agent connection gets closed.
onAgentConnect = () => {
  console.log("Live session started")
  const onAgentDisconnect =  () => console.log("Live session stopped")
  return onAgentDisconnect
}
  • onCallStart: () => (()=>void | void): This callback function is fired as soon as a call (webRTC) starts. It can also return onCallEnd which will be called when the call ends. In case of an unstable connection, this may be called several times. Below is an example:
onCallStart: () => {
  console.log("Call started")
  const onCallEnd = () => console.log("Call ended")
  return onCallEnd
}
  • onRemoteControlStart: () => (()=>void | void): This callback function is fired as soon as a remote control session starts. It can also return onRemoteControlEnd which will be called when the remote control permissions are revoked. Below is an example:
onCallStart: () => {
  console.log("Remote control started")
  const onCallEnd = () => console.log("Remote control ended")
  return onCallEnd
}

Troubleshooting

Critical dependency: the request of a dependency is an expression

Please apply this workaround if you face the below error when compiling:

Failed to compile.

./node_modules/peerjs/dist/peerjs.min.js
Critical dependency: the request of a dependency is an expression

If you encounter any other issue, please connect to our Slack and get help from our community.