Expo FAQ's
This section addresses frequently asked questions about the AppTrove Expo SDK integration, troubleshooting common issues, and providing solutions for typical problems developers encounter.
General Questions
Q: What is the AppTrove Expo SDK?
A: The AppTrove Expo SDK is a comprehensive tracking solution for Expo and React Native applications. It provides attribution tracking, event tracking, deep linking, and campaign analytics to help you understand user behavior and optimize your app's performance.
Q: Which platforms does the Expo SDK support?
A: The AppTrove Expo SDK supports both Android and iOS platforms. It works with Expo managed workflow, development builds, and bare React Native projects.
Q: What are the minimum requirements for the Expo SDK?
A: The minimum requirements are:
- Expo SDK 48 or later
- React Native 0.70 or later
- Android API 21 (Android 5.0) or later
- iOS 10.0 or later
Installation & Setup
Q: How do I install the AppTrove Expo SDK?
A: Install the SDK using npm or yarn:
npm install trackier-expo-sdk
# or
yarn add trackier-expo-sdk
Q: Do I need to configure anything for iOS in bare workflow?
A: Yes, for iOS in bare workflow, you need to install CocoaPods dependencies:
cd ios && pod install && cd ..
Q: What Android permissions are required?
A: The following permissions are required in your AndroidManifest.xml
:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
SDK Initialization
Q: How do I get my SDK key?
A: To get your SDK key:
- Log in to your Trackier Panel
- Select your application
- Navigate to SDK Integration in the dashboard
- Copy the SDK Key displayed
Q: What environments are supported?
A: The SDK supports three environments:
TrackierConfig.EnvironmentDevelopment
- For developmentTrackierConfig.EnvironmentTesting
- For testingTrackierConfig.EnvironmentProduction
- For production
Q: How do I configure SDK signing?
A: Use the setAppSecret
method during initialization:
const trackierConfig = new TrackierConfig(TR_SDK_KEY, TrackierConfig.EnvironmentDevelopment);
trackierConfig.setAppSecret("your_secret_id", "your_secret_key");
TrackierSDK.initialize(trackierConfig);
Event Tracking
Q: What built-in events are available?
A: The SDK supports many built-in events including:
LOGIN
,REGISTER
,LOGOUT
PURCHASE
,ADD_TO_CART
,VIEW_CART
SEARCH
,PRODUCT_VIEW
APP_OPEN
,TUTORIAL_COMPLETE
- And many more...
Q: How do I track a custom event?
A: Create a custom event in your Trackier dashboard and use the event ID:
const event = new TrackierEvent("your_custom_event_id");
TrackierSDK.trackEvent(event);
Q: How do I add parameters to events?
A: Use the param1-param10 properties or the ev object:
const event = new TrackierEvent(TrackierEvent.PURCHASE);
event.param1 = "Product123";
event.revenue = 29.99;
event.currency = "USD";
event.ev = { customKey: "customValue" };
TrackierSDK.trackEvent(event);
Deep Linking
Q: How do I set up deep linking?
A: For Android, add intent filters to your AndroidManifest.xml
. For iOS, configure Associated Domains in Xcode. The SDK automatically handles deferred deep linking.
Q: How do I handle deferred deep links?
A: Configure a callback during SDK initialization:
trackierConfig.setDeferredDeeplinkCallbackListener((uri: string) => {
console.log("Deferred deep link:", uri);
// Handle the deep link
});
Campaign Data
Q: How do I get campaign data?
A: Use the available getter functions:
const ad = await TrackierSDK.getAd();
const campaign = await TrackierSDK.getCampaign();
const channel = await TrackierSDK.getChannel();
Q: When is campaign data available?
A: Campaign data is only available if the user came through a Trackier tracking link. It may not be immediately available after SDK initialization.
Troubleshooting
Q: Events are not appearing in my dashboard
A: Check the following:
- Verify your SDK key is correct
- Ensure the SDK is properly initialized
- Check your internet connection
- Verify you're using the correct environment setting
Q: Deep links are not working
A: Common issues:
- Check your Android manifest configuration
- Verify iOS Associated Domains setup
- Ensure the callback is set before SDK initialization
- Test on real devices, not simulators
Q: Campaign data is null
A: Campaign data is only available if:
- The user came through a Trackier tracking link
- The tracking link was properly configured
- The user has the app installed
Q: Build errors on Android
A: Common solutions:
- Clean and rebuild your project
- Check that all dependencies are properly added
- Verify ProGuard rules if using code obfuscation
- Ensure Google Services JSON is in the correct location
Q: Build errors on iOS
A: Common solutions:
- Run
pod install
in the ios directory - Clean the build folder in Xcode
- Check that all iOS dependencies are properly linked
- Verify Associated Domains configuration
Performance & Best Practices
Q: Does the SDK affect app performance?
A: The SDK is designed to be lightweight and efficient. It runs background operations asynchronously and has minimal impact on app performance.
Q: How do I handle errors gracefully?
A: Wrap SDK calls in try-catch blocks:
try {
const event = new TrackierEvent(TrackierEvent.PURCHASE);
TrackierSDK.trackEvent(event);
} catch (error) {
console.error('Error tracking event:', error);
}
Q: Should I track events on every user action?
A: Track events that provide meaningful insights for your business. Avoid over-tracking as it can impact performance and data quality.
Support
Q: Where can I get help?
A: For support:
- Check the Trackier documentation
- Contact Trackier support at support@trackier.com
- Review the example app in the SDK repository
Q: How do I report a bug?
A: Report bugs by:
- Contacting Trackier support with detailed information
- Including your SDK version and platform details
- Providing steps to reproduce the issue
- Including relevant logs and error messages
Android-Specific Issues
Q: Why does my Expo app crash on Android 7 due to GMS (Google Mobile Services)?
A: The app crashes on Android 7 devices with the following error:
Caused by java.lang.NoClassDefFoundError: Failed resolution of: Ljava/time/Duration;
at com.google.android.gms.ads.identifier.zzd.<clinit>(zzd.java)
at com.google.android.gms.ads.identifier.zzd.zza(zzd.java)
at com.google.android.gms.ads.identifier.AdvertisingIdClient.getAdvertisingIdInfo(AdvertisingIdClient.java)
at java.lang.reflect.Method.invoke(Method.java)
at com.trackier.sdk.DeviceInfo$Companion.getGAID(DeviceInfo.java)
at com.trackier.sdk.TrackierSDKInstance.initGaid(SourceFile)
at com.trackier.sdk.TrackierSDKInstance.access$initGaid(SourceFile)
at com.trackier.sdk.TrackierSDKInstance$initialize$1.invokeSuspend(TrackierSDKInstance.java)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(BaseContinuationImpl.java)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.java:1)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.java:1)
at kotlinx.coroutines.scheduling.TaskImpl.run(TaskImpl.java:1)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.java:1)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.java:1)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.java:1)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.java:1)
Cause: This error occurs because Android 7 (API level 24) doesn't natively support the java.time.Duration
class, which was introduced in Android 8 (API level 26). The Google Mobile Services (GMS) library tries to use this class, causing a NoClassDefFoundError
.
Solution: Add the following dependency to your android/app/build.gradle
file:
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
// Add this dependency:
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
}
}
dependencies {
// Add this dependency:
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
}
Explanation: The coreLibraryDesugaring
dependency provides backported versions of Java 8+ APIs (including java.time.Duration
) for older Android versions, allowing the GMS library to work properly on Android 7 devices.