Troubleshooting
Common issues and solutions when using the Tappd Mobile SDK.
SDK Not Initializing
Problem: SDK fails to initialize
Symptoms:
- Error: "App ID is required"
- Events not tracking
Solutions:
javascript
// ❌ Wrong: Missing appId
const tappd = new TappdSDK({});
// ✅ Correct: Include appId
const tappd = new TappdSDK({
appId: 'YOUR_APP_ID'
});Check:
- App ID is correct from dashboard
- App ID is not empty or undefined
- SDK is imported correctly
Events Not Tracking
Problem: Events not appearing in dashboard
Symptoms:
track()calls complete without errors- No events visible in dashboard
Solutions:
- Enable debug mode:
javascript
const tappd = new TappdSDK({
appId: 'YOUR_APP_ID',
debug: true // Enable console/logging
});Check network requests:
- Use React Native debugger or Flipper
- Check Network tab for API requests
- Verify requests are being sent
- Check response status codes
Verify API URL:
javascript
const tappd = new TappdSDK({
appId: 'YOUR_APP_ID',
apiUrl: 'https://sdk.gotappd.com/api/v1/sdk' // Verify URL
});- Check async/await:
javascript
// ❌ Wrong: Not awaiting
tappd.track('event');
// ✅ Correct: Await the promise
await tappd.track('event');Anonymous Data Not Merging
Problem: Anonymous events not linked after identification
Solutions:
- Ensure identify() is called with external_id:
javascript
// Events tracked while anonymous
await tappd.track('event_1');
await tappd.track('event_2');
// Identify user (merges previous events)
await tappd.identify({
external_id: 'user_123', // Required: Your internal user ID
email: 'john@example.com'
});- Check anonymous ID:
javascript
const anonymousId = tappd.getAnonymousId();
console.log('Anonymous ID:', anonymousId);Session Issues
Problem: Sessions not starting or expiring incorrectly
Solutions:
- Check session timeout:
javascript
const tappd = new TappdSDK({
appId: 'YOUR_APP_ID',
sessionTimeout: 60 // Increase timeout (minutes)
});- Verify session ID:
javascript
const sessionId = tappd.getSessionId();
console.log('Session ID:', sessionId);
// Should not be null after initializationScreen Tracking Not Working
Problem: Screen views not tracked
Symptoms:
- Only some screens tracked
- Screen views missing
Solutions:
- Manual tracking with useFocusEffect:
javascript
import { useFocusEffect } from '@react-navigation/native';
function MyScreen() {
useFocusEffect(
React.useCallback(() => {
tappd.trackScreen('MyScreen');
}, [])
);
}- Check React Navigation setup:
- Ensure NavigationContainer is properly configured
- Verify screen names are consistent
Push Token Registration Fails
Problem: registerPushToken() fails
Symptoms:
- Error: "User must be identified first"
- Token not registering
Solutions:
- Identify user first:
javascript
// ✅ Correct: Identify before registering token
await tappd.identify({
external_id: 'user_123', // Required: Your internal user ID
email: 'john@example.com'
});
await tappd.registerPushToken(token, 'ios');Check FCM/APNs setup:
- Verify Firebase configuration
- Check APNs certificates for iOS
- Verify google-services.json for Android
Verify token:
javascript
const token = await messaging().getToken();
console.log('FCM Token:', token);
// Should not be null or emptyAsyncStorage Issues
Problem: Anonymous ID not persisting
Symptoms:
- New anonymous ID on every app launch
- User appears as new each time
Solutions:
- Check AsyncStorage installation:
bash
npm install @react-native-async-storage/async-storage
cd ios && pod install && cd ..- Verify AsyncStorage works:
javascript
import AsyncStorage from '@react-native-async-storage/async-storage';
AsyncStorage.setItem('test', 'value').then(() => {
AsyncStorage.getItem('test').then((value) => {
console.log('AsyncStorage works:', value === 'value');
});
});Build Errors
Problem: Build fails with SDK
iOS:
- Run pod install:
bash
cd ios && pod install && cd ..- Clean build:
bash
cd ios
rm -rf build
rm -rf Pods
pod install
cd ..Android:
- Clean build:
bash
cd android
./gradlew clean
cd ..- Check dependencies:
- Verify all required packages installed
- Check for version conflicts
TypeScript Errors
Problem: Type errors in TypeScript projects
Solutions:
- Install types:
bash
npm install --save-dev @types/react-native- Import types:
typescript
import TappdSDK, { TappdConfig, CustomerAttributes } from '@tappd/mobile-sdk';
const config: TappdConfig = {
appId: 'YOUR_APP_ID'
};
const tappd = new TappdSDK(config);Debug Mode
Enable debug mode to troubleshoot:
javascript
const tappd = new TappdSDK({
appId: 'YOUR_APP_ID',
debug: true
});
// Check logs/console for:
// [Tappd SDK] Initialized with App ID: a1b2c3d4...
// [Tappd SDK] New session started: sess_abc123
// [Tappd SDK] Event tracked: purchase
// [Tappd SDK] Customer identified: user_123Getting Help
If you're still experiencing issues:
- Check logs in React Native debugger
- Enable debug mode and review logs
- Verify network requests in Network tab
- Check SDK version - ensure using latest
- Contact support with:
- Error messages
- Platform (iOS/Android)
- React Native version
- SDK version
- Debug logs
Common Error Messages
"App ID is required"
- Cause: Missing or empty
appId - Fix: Provide valid
appIdfrom dashboard
"User must be identified first"
- Cause: Calling methods that require identification
- Fix: Call
identify()before these methods
"Request failed: ..."
- Cause: Network or API error
- Fix: Check API URL, network connection
"AsyncStorage error"
- Cause: AsyncStorage not installed or configured
- Fix: Install
@react-native-async-storage/async-storageand run pod install
Next Steps
- API Reference - Review method documentation
- Configuration - Check configuration options
- Examples - See working examples
