Event Logging with Amplitude & React Native

Adnan Sahinovic
Nerd For Tech
Published in
Jan 3, 2024

Short step-by-step guide on installing, logging events, and setting user properties with React Native and Amplitude

Photo by Jeremy Perkins on Unsplash

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.

Initialize Amplitude and create helper functions

Remember to add your API key and set any user property you wish to track

3. Log events and set user properties

log the event and set user properties in your component

Make sure to rebuild your app, and you’re good to start capturing user events with Amplitude.

--

--

Adnan Sahinovic
Nerd For Tech

Building tools on phones and browsers and documenting my expedition. React-Native since v0.5 • Android dev since KitKat