React-Native-Amplitude
React-Native wrapper for the Amplitude SDK
Getting started
npm install rnamplitudebridge --save
Include the Amplitude SDK
Include the Amplitude SDK in your project to make it available to the wrapper (bridge) library. You can find instructions for installing the SDK here. We recommend installing the SDK as a POD for your iOS project. The PVAmplitudeBridge project will search for header files in the Pods directory.
Linking the project
You need to link the pvamplitudebridge project so that it will be reachable in your project.
$ react-native link rnamplitudebridge
Manual Installation
iOS
- In Xcode, use the project navigator to add files to the
Libraries
folder by right clicking onAdd Files to [your project's name]
- Go to
node_modules
->rnamplitudebridge
and addPVAmplitudeBridge.xcodeproj
- In Xcode, select your project in the project navigator. Add the
libPVAmplitudeBridge.a
to your project'sBuild Phases
->Link Binary With Libraries
- Run your project (
Cmd+R
)
Usage
Initialize Amplitude
PVAmplitude
Track an Event
PVAmplitude
Track an Event with Properties
let properties = propA: "value A" propB: "value B"PVAmplitude
Setting Event Properties
Tracking Sessions
// returns a promise
Setting Custom User IDS and Setting User Properties