change(tracker): add docs link to readme

This commit is contained in:
sylenien 2022-12-12 17:51:15 +01:00
parent cbbe26a3d5
commit 0ed4444c1d
2 changed files with 28 additions and 20 deletions

View file

@ -2,6 +2,10 @@
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)[https://docs.openreplay.com/plugins/assist]
## Installation
```bash
@ -72,7 +76,7 @@ trackerAssist({
type ConfirmOptions = {
text?:string,
style?: StyleObject, // style object (i.e {color: 'red', borderRadius: '10px'})
confirmBtn?: ButtonOptions,
confirmBtn?: ButtonOptions,
declineBtn?: ButtonOptions
}
@ -82,7 +86,7 @@ type ButtonOptions = HTMLButtonElement | string | {
}
```
- `callConfirm`: Customize the text and/or layout of the call request popup.
- `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.

View file

@ -2,10 +2,14 @@
The main package of the [OpenReplay](https://openreplay.com/) tracker.
## Documentation
For launch options and available public methods, (refer to the documentation)[https://docs.openreplay.com/installation/javascript-sdk#options]
## Installation
```bash
npm i @openreplay/tracker
npm i @openreplay/tracker
```
## Usage
@ -13,30 +17,30 @@ npm i @openreplay/tracker
Initialize the package from your codebase entry point and start the tracker. You must set the `projectKey` option in the constructor. Its value can can be found in your OpenReplay dashboard under [Preferences -> Projects](https://app.openreplay.com/client/projects).
```js
import Tracker from '@openreplay/tracker';
import Tracker from '@openreplay/tracker'
const tracker = new Tracker({
projectKey: YOUR_PROJECT_KEY,
});
tracker.start({
userID: "Mr.Smith",
metadata: {
version: "3.5.0",
balance: "10M",
role: "admin",
}
}).then(startedSession => {
if (startedSession.success) {
console.log(startedSession)
}
})
tracker
.start({
userID: 'Mr.Smith',
metadata: {
version: '3.5.0',
balance: '10M',
role: 'admin',
},
})
.then((startedSession) => {
if (startedSession.success) {
console.log(startedSession)
}
})
```
Then you can use OpenReplay JavaScript API anywhere in your code.
```js
tracker.setUserID('my_user_id');
tracker.setMetadata('env', 'prod');
tracker.setUserID('my_user_id')
tracker.setMetadata('env', 'prod')
```
Read [our docs](https://docs.openreplay.com/) for more information.