React Native SDK - Initializing the SDK
Installation
Section titled InstallationThe 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
Initialization
Section titled InitializationWhen 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’.
Adding the tracking code
Section titled Adding the tracking codeAdd the following code to your root file:
import Openreplay from '@openreplay/react-native';
// ...
useEffect(() => {
OpenReplay.tracker.startSession(
'yourProjectKey',
options, // explained below, set {} if empty
'https://local.openreplay.instance/ingest' // not required if you're using managed version
);
}, [])
Sanitize Data
Section titled Sanitize DataSee how to sanitize data in React Native replays for more details.
Initialization Options
Section titled Initialization OptionsBy default, all options are marked as true:
crashes: BoolEnables crashlytics.analytics: BoolEnables analytics tracking of marked views.performances: BoolEnables performance listener.logs: BoolEnables logs listener.screen: BoolEnables screen recorder.