Integrating the SDK
Requirements:
- Android API 16
- iOS Target 12.4
- tvOS Target 13
- Xcode 15.3
- ReactNative 0.73
- Native Code support enabled
Supported Platforms:
- Android
- Android TV
- iOS
- tvOS
Data Privacy:
Migration:
If you are migrating from a Kochava SDK prior to version 3.0.0 to version 3.x usage can be updated by reviewing the code samples for any given topic, as the overall usage of the SDK remains the same.
Integration:
In order to use the Kochava SDK, first add it within your project. This can be accomplished using npm (recommended) or by downloading the SDK files manually and adding them.
- Using a terminal navigate to the root directory of your ReactNative Project.
- Run the following commands:
- If you are building your project with Expo, add the following to the list of plugins found in your app.json file.
npm install react-native-kochava-measurement --save cd ios && pod install && cd ..
"react-native-kochava-measurement/expo-kochava"
To align with Apple’s Privacy Manifest requirements, the ability to collect and transmit the IDFA has been moved into a separate, optional tracking module. Without this module, the SDK will not collect or transmit the IDFA. To include these tracking capabilities:
- Run the following commands from the root of your ReactNative project.
npm install react-native-kochava-measurement-apple-tracking --save cd ios && pod install && cd ..
- Download the latest version from the Download Badge above to the root directory of your ReactNative Project.
- Using a terminal navigate to the root directory of your ReactNative Project.
- Run the following commands:
- If you are building your project with Expo, add the following to the list of plugins found in your app.json file.
npm install react-native-kochava-measurement.tgz --save cd ios && pod install && cd ..
"react-native-kochava-measurement/expo-kochava"
To align with Apple’s Privacy Manifest requirements, the ability to collect and transmit the IDFA has been moved into a separate, optional tracking module. Without this module, the SDK will not collect or transmit the IDFA. To include these tracking capabilities:
- Run the following commands from the root of your ReactNative project.
npm install react-native-kochava-measurement-apple-tracking.tgz --save cd ios && pod install && cd ..
Starting the Tracker
Once you have added the Kochava SDK to your project, the next step is to configure and start the Kochava Tracker in code. Only your App GUID is required to start the tracker with the default settings, which is the case for typical integrations.
We recommend starting the tracker as soon as the application starts, although this can be done later if needed. Starting the tracker as early as possible will provide more accurate session reporting and help to ensure the tracker has been started before using it. Keep in mind the tracker can only be configured and started once per launch.
import { KochavaMeasurement } from 'react-native-kochava-measurement'; KochavaMeasurement.instance.registerAndroidAppGuid("YOUR_ANDROID_APP_GUID"); KochavaMeasurement.instance.registerIosAppGuid("YOUR_IOS_APP_GUID"); KochavaMeasurement.instance.start();
import { KochavaTracker } from 'react-native-kochava-tracker'; KochavaTracker.instance.registerAndroidAppGuid("YOUR_ANDROID_APP_GUID"); KochavaTracker.instance.registerIosAppGuid("YOUR_IOS_APP_GUID"); KochavaTracker.instance.start();
Confirm the Integration
Where to Go From Here:
Now that you have completed integration you are ready to utilize the many features offered by the Kochava SDK. Continue on to Using the SDK and choose a topic.