JavaScript SDK - use method

Details about the use method from OpenReplay's SDK

JavaScript SDK ⁠-⁠ use method

This method attaches a plugin (such as Assist, Redux or GraphQL) to the tracker and returns the plugin’s result, for example the middleware you wire into your store.

use<T>(plugin: (app: App | null, options?: Partial<Options>) => T): T
  • plugin: The plugin function, usually created by calling the plugin package’s default export.

Returns whatever the plugin returns. Call it after configure() (or after creating the class instance): before that, and on the server, the tracker singleton passes null to the plugin, which then returns an inert version that records nothing.

import { tracker } from '@openreplay/tracker'
import trackerAssist from '@openreplay/tracker-assist'

tracker.configure({ projectKey: PROJECT_KEY })
tracker.use(trackerAssist())