- react-native >=0.77
- Android: minSdkVersion >= 24
Before proceeding, identify your project type:
- Expo Projects: Use Expo CLI, have an
app.json
orapp.config.js
file, and may use EAS Build - React Native CLI Projects: Use React Native CLI, have separate
android/
andios/
directories
Requirements for Expo:
- Expo SDK 50+
- Custom development builds (Expo plugins require custom native code)
⚠️ Note: This will NOT work with Expo Go due to native dependencies
# Using npm
npm install --save @trackingplan/react-native
# Using yarn
yarn add @trackingplan/react-native
Add the plugin to your app.config.js
or app.json
. Replace YOUR_TP_ID
with your actual Trackingplan ID (found in your Trackingplan dashboard).
Option A: app.config.js
export default {
expo: {
name: 'Your App',
// ... other config
plugins: [
[
'@trackingplan/react-native',
{
tpId: 'YOUR_TP_ID', // Replace with your actual Trackingplan ID
},
],
],
},
};
Option B: app.json
{
"expo": {
"name": "Your App",
"plugins": [
[
"@trackingplan/react-native",
{
"tpId": "YOUR_TP_ID"
}
]
]
}
}
# For development builds
npx expo run:android
npx expo run:ios
# For EAS builds
eas build --platform android
eas build --platform ios
The Expo plugin automatically handles:
- Android Gradle dependencies and configuration
- iOS CocoaPods dependency
- Native initialization code with your Trackingplan ID
No additional configuration needed!
For React Native CLI projects, manual native configuration is required.
# Using npm
npm install --save @trackingplan/react-native
# Using yarn
yarn add @trackingplan/react-native
-
Update root build.gradle
Open
/android/build.gradle
and add the Trackingplan adapter:buildscript { ext { // ... other ext properties trackingplanVersion = findProject(':trackingplan_react-native').ext.get('trackingplanVersion') } dependencies { // ... other dependencies classpath "com.trackingplan.client:adapter:$trackingplanVersion" } }
Important: Use the programmatic approach above to ensure version compatibility. Hardcoding a version string may cause compatibility issues.
-
Apply the Gradle plugin
Modify
/android/app/build.gradle
:// ... other plugins apply plugin: "com.trackingplan.client"
-
Initialize in MainApplication
Open
/android/app/src/main/java/com/{projectName}/MainApplication.kt
:import com.trackingplan.client.sdk.Trackingplan // Add this import class MainApplication : Application(), ReactApplication { override fun onCreate() { super.onCreate() Trackingplan.init("YOUR_TP_ID").start(this) // Add this line // ...other code } }
Open /ios/{projectName}/AppDelegate.swift
:
import Trackingplan // Add this import
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
Trackingplan.initialize(tpId: "YOUR_TP_ID") // Add this line
// ...other code
return true
}
}
# For Android
npx react-native run-android
# For iOS
cd ios/
pod install --repo-update
cd ..
npx react-native run-ios
At this point, your app is ready to start monitoring traffic sent to your data destinations with Trackingplan.
Questions? Problems? Need more info? We can help! Contact us here.
Visit www.trackingplan.com
Copyright © 2025 Trackingplan Inc. All Rights Reserved.
Made with create-react-native-library