Userpilot React Native Module enables you to capture user insights and deliver personalized in-app experiences in real time. With just a one-time setup, you can immediately begin leveraging Userpilot’s analytics and engagement features to understand user behaviors and guide their journeys in-app.This document provides a step-by-step walkthrough of the installation and initialization process, as well as instructions on using the SDK’s public APIs.
Your application should use React Native version 0.73 or above. Applications using Expo should use version 50 or above. The New Architecture is fully supported.
React Native - your application should use React Native version 0.73 or above. Applications using Expo should use version 50 or above. The New Architecture is fully supported starting with version 4.4.0.Android - your application’s build.gradle must have a compileSdk of 35+ and minSdk of 21+, and use Android Gradle Plugin (AGP) 8.6+ (8.8.2+ recommended).
For AGP versions < 8.8.2 (React Native versions < 0.79), you may need to add the following line to your gradle.properties:android.experimental.lint.version = 8.8.2
Your application must target iOS 13+ to install and render Userpilot content. Update the iOS project xcodeproj to set the deployment target, if needed. In the application’s Podfile , include at least this minimum version.
To use Userpilot, initialize it once in your Application class. This ensures the SDK is ready as soon as your app starts. Update your Application class. Replace <APP_TOKEN> with your Application Token, which can be fetched from your Environments Page.
import * as Userpilot from '@userpilot/react-native'await Userpilot.setup('<APP_TOKEN>', { logging: true })
This API is used to identify unique users and companies (groups of users) and set their properties. Once identified, all subsequent tracked events and screens will be attributed to that user.
ImportantIt’s crucial to call the Userpilot identify function; without it, Userpilot won’t be able to recognize your users, and mobile content won’t be displayed to them.
Recommended Usage:
On user authentication (login): Immediately call identify when a user signs in to establish their identity for all future events.
On app launch for authenticated users: If the user has a valid authenticated session, call identify at app launch.
Upon property updates: Whenever user or company properties change.
Key id is required in company properties, to identify a unique company.
Userpilot supports String, Numeric, and Date types.
Make sure you’re sending date values in ISO8601 format.
If you are planning to use Userpilot’s localization features, make sure you are passing user property locale_code with a value that adheres to ISO 639-1 format.
Userpilot’s reserved properties’ have pre-determined types and improve profiles interface in the dashboard:
Use key email to pass the user’s email.
Use key name to pass the user’s or company’s name.
Use key created_at to pass the user’s or company’s signed up date.
Notes
Ensure the User ID source is consistent across Web, Android, and iOS.
While properties are optional, setting them enhances Userpilot’s segmentation capabilities.
Calling screen is crucial for unlocking Userpilot’s core engagement and analytics capabilities. When a user navigates to a particular screen, invoking screen records that view and triggers any eligible in-app experiences. Subsequent events are also attributed to the most recently tracked screen, providing context for richer analytical insights. For these reasons, we strongly recommend tracking all of your app’s screen views.
Log any meaningful action the user performs. Events can be button clicks, form submissions, or any custom activity you want to analyze. Optionally, you can pass metadata with the event to provide specific context.