openreplay/tracker/tracker
Andrey Babushkin 5a410e63b3
Update batch writer (#3205)
* fix(helm): add CORS config to Assist ingress

Configure CORS headers and debug session information for the Assist
service's ingress to ensure proper cross-origin requests handling and
improved debugging capabilities.

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>

* add timestamp to prepare method

* update test

---------

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
Co-authored-by: rjshrjndrn <rjshrjndrn@gmail.com>
2025-03-24 17:25:09 +01:00
..
.yarn Update batch writer (#3205) 2025-03-24 17:25:09 +01:00
scripts tracker: rm unused files 2024-10-18 13:24:53 +02:00
src Update batch writer (#3205) 2025-03-24 17:25:09 +01:00
.eslintignore change(tracker): unit tests for tracker 2023-02-06 12:42:18 +01:00
.eslintrc.cjs chore(tracker): update rollup, setup nvmrc conf 2023-10-23 13:18:34 +02:00
.gitignore tracker: rm unused files 2024-10-18 13:24:53 +02:00
.npmignore tracker: rm unused files 2024-10-18 13:24:53 +02:00
.nvmrc chore(tracker): update rollup, setup nvmrc conf 2023-10-23 13:18:34 +02:00
.prettierignore Message protocol update (message size) (#663) 2022-08-22 12:32:48 +02:00
.prettierrc.json Message protocol update (message size) (#663) 2022-08-22 12:32:48 +02:00
.yarnrc.yml ui: fix q controls 2024-11-19 10:36:50 +01:00
CHANGELOG.md tracker: "secure by default" mode; 16.1.0 2025-03-24 15:09:03 +01:00
jest.config.js tracker: fix jest config, update test cases 2025-03-24 15:09:03 +01:00
js_errors.txt feat: tracker init 2021-05-03 13:31:55 +02:00
LICENSE MIT license for OpenReplay protocol 2022-08-30 19:04:32 +02:00
package.json tracker: "secure by default" mode; 16.1.0 2025-03-24 15:09:03 +01:00
README.md update docs links (#3076) 2025-02-28 16:54:04 +01:00
rollup.config.js tracker: introduce singleton approach for tracker 2025-03-05 15:56:53 +01:00
tsconfig-base.json Better network sanitizer (#2969) 2025-01-24 14:06:34 +01:00

OpenReplay Tracker

The main package of the OpenReplay tracker.

Development & Contribution

Please use bun to install and build this library. Any submitted pull request must pass all tests and should have positive test coverage diff %.

Documentation

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

Installation

npm i @openreplay/tracker

Usage

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.

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)
    }
  })

Then you can use OpenReplay JavaScript API anywhere in your code.

tracker.setUserID('my_user_id')
tracker.setMetadata('env', 'prod')