React Native SDK ⁠-⁠ Initializing the SDK

The following line will install the tracker and with it the SDK for you to take advantage of all tracker features.

npm i @openreplay/react-native

When instantiating OpenReplay’s tracker, there are several configuration options you can provide to customize many aspects of the recording and the recording experience. You must set the projectKey option in the constructor. You can get this value from your OpenReplay dashboard under ‘Preferences > Projects’.

Add the following code to your root file:

import Openreplay from '@openreplay/react-native';

// ...
useEffect(() => {
    options, // explained below, set {} if empty
    'https://local.openreplay.instance/ingest' // not required if you're using managed version
}, [])

See how to sanitize data in React Native replays for more details.

By default, all options are marked as true:

  • crashes: Bool Enables crashlytics.
  • analytics: Bool Enables analytics tracking of marked views.
  • performances: Bool Enables performance listener.
  • logs: Bool Enables logs listener.
  • screen: Bool Enables screen recorder.