Installing the trackers
To instrument tracking, you will need to install tracker libraries both in the Web view as well as the native mobile app.
Snowplow WebView tracker installation
To install the WebView tracker in your JavaScript or TypeScript app, add the npm package:
npm install --save @snowplow/webview-tracker
You will then be able to use the functions provided by the WebView tracker as follows:
import { trackSelfDescribingEvent } from '@snowplow/webview-tracker';
There is no need to configure the WebView tracker. All configuration is done in the native layer as explained next.
Snowplow iOS, Android and React Native tracker installation
First, you will need to install the Snowplow tracker package in your app. Below, we show how to do so using the Swift Package Manager (SPM) on iOS and Gradle on Android. To learn about other options for installing the trackers (e.g. using CocoaPods or Carthage on iOS), see the mobile tracker documentation.
You can install the tracker using SPM as follows:
- In Xcode, select File > Swift Packages > Add Package Dependency.
- Add the url where to download the library: https://github.com/snowplow/snowplow-objc-tracker
The tracker can be installed using Gradle. Add the following to your build.gradle
file:
dependencies {
...
// Snowplow Android Tracker
implementation 'com.snowplowanalytics:snowplow-android-tracker:3.+'
// In case 'lifecycleAutotracking' is enabled
implementation 'androidx.lifecycle-extensions:2.2.+'
...
}
To install the tracker, add it as a dependency to your React Native app:
npm install --save @snowplow/react-native-tracker