React Native
One init covers both platforms. Autolinking registers the native module, so there are no manual linking steps:
Call init() once, at the top of your app entry file:
Get your key and the rest of the values from Add application. See Add an application.
Screens, taps, app start, crashes, and uncaught JS errors are captured from this call on. Set captureJsErrors to false if you install your own JS error handler. Name a screen with setCurrentScreen(), send a custom event with addEvent(), and report a handled error with reportError().
The SDK ships native code, so it doesn’t run in Expo Go. Use a development build.
Add the config plugin to your app config:
Then create the development build:
The plugin registers the native module on Android, and iOS needs no extra setup. It works with the New Architecture, and everything else on this page applies unchanged.
Capture HTTP requests
Section titled “Capture HTTP requests”On Android, React Native sends both fetch and XMLHttpRequest through OkHttp, so one change in MainApplication.kt covers both:
Identify the user
Section titled “Identify the user”Set the user after sign-in with setUser(), and call endSession() on sign-out. A mobile session runs for up to four hours and survives the process being killed, so without that call a sign-out followed by a different sign-in keeps one session ID across both people.