Event Logging with Amplitude & React Native
Short step-by-step guide on installing, logging events, and setting user properties with React Native and Amplitude
1. Instal npm modules
Let's start by installing the dependencies we need to run Amplitude.
npm install @amplitude/react-native
or
yarn add @amplitude/react-native
if you want to make it work with iOS, you need to do an additional step and install pod files:
cd ios && pod install
2. Create a base code
Initialize Amplitude and create helper functions we can reuse across the app.
Remember to add your API key and set any user property you wish to track
3. Log events and set user properties
Make sure to rebuild your app, and you’re good to start capturing user events with Amplitude.