React Native SDK
The InHouse React Native SDK provides comprehensive tracking and analytics capabilities for your mobile applications, including user behavior tracking, deep linking support, install attribution, and device fingerprinting.Installation
NPM Package
Install the SDK using npm:Using yarn
Platform Setup
iOS Setup
- Install CocoaPods dependencies:
- Add Thumbmark Swift Package Dependency:
- Open your iOS project in Xcode (
ios/YourApp.xcworkspace) - Go to File → Add Package Dependencies…
- Enter the repository URL:
https://github.com/thumbmarkjs/thumbmark-swift - Select Up to Next Major Version and click Add Package
- Select the Thumbmark target and click Add Package
Package.swift dependencies:
- Configure URL Schemes in
ios/YourApp/Info.plist:
- Add Associated Domains for universal links:
Android Setup
The SDK uses React Native’s autolinking feature for automatic integration.- Add Install Referrer Receiver to
android/app/src/main/AndroidManifest.xml:
- Configure Deep Link Intent Filters in your main activity:
Quick Start
Basic Setup
Initialize the SDK in your app:Handle App Lifecycle
Event Tracking
Track App Open
Track when users open your app:Track Session Start
Track user sessions:Track Short Link Clicks
Track when users interact with your short links:Install Attribution
Install Referrer Tracking
Track install attribution and referrer data:Reset First Install State
For testing install attribution:Real-time Event Callbacks
Listen to SDK events in real-time:Deep Link Handling
Handle incoming deep links from TryInHouse short links:Device Fingerprinting
Thumbmark Integration
The SDK includes Thumbmark for device fingerprinting:Configuration Options
Debug Mode
Enable comprehensive logging during development:Dependency Versions
You can override dependency versions in yourandroid/build.gradle:
TryInHouse Platform Configuration
Configure Well-Known Files
-
Log in to TryInHouse Dashboard:
- Go to https://app.tryinhouse.co/
- Sign in to your account or create a new one
-
Navigate to Project Settings:
- Select your project from the dashboard
- Go to Settings → Linkings
- Configure iOS Universal Links (apple-app-site-association):
- Configure Android App Links (assetlinks.json):
API Reference
Core Methods
| Method | Description | Parameters | Returns |
|---|---|---|---|
initialize() | Initialize the SDK | projectId, projectToken, domain, serverUrl?, debugMode? | Promise<string> |
onAppResume() | Handle app resume | None | Promise<void> |
onNewURL() | Handle new URL | url: string | Promise<void> |
trackAppOpen() | Track app open event | shortLink? | Promise<string> |
trackSessionStart() | Track session start | shortLink? | Promise<string> |
trackShortLinkClick() | Track link click | shortLink, deepLink? | Promise<string> |
getInstallReferrer() | Get stored referrer | None | Promise<string> |
fetchInstallReferrer() | Fetch fresh referrer | None | Promise<string> |
resetFirstInstall() | Reset install state | None | Promise<void> |
Device Fingerprinting Methods
| Method | Description | Parameters | Returns |
|---|---|---|---|
getFingerprint() | Get device fingerprint | None | Promise<string> |
getFingerprintId() | Get fingerprint ID | algorithm? | Promise<string> |
Event Listeners
| Method | Description | Parameters | Returns |
|---|---|---|---|
addCallbackListener() | Add event listener | callback: (data) => void | EmitterSubscription |
removeCallbackListener() | Remove specific listener | subscription | void |
removeAllListeners() | Remove all listeners | None | void |
TypeScript Types
Testing and Debugging
Test Deep Link Handling
Example Test Scenarios
Troubleshooting
Common Issues
SDK Not Initialized
SDK Not Initialized
- Check project ID and project token - Verify TryInHouse dashboard configuration - Check network connectivity - Enable debug logging to see detailed error messages
Deep Links Not Working
Deep Links Not Working
- Verify AndroidManifest.xml intent filters - Check iOS URL schemes in Info.plist - Ensure well-known files are properly configured - Test with adb command for Android
Install Referrer Not Tracked
Install Referrer Not Tracked
- Verify InstallReferrerReceiver is added to AndroidManifest.xml - Test with
Google Play Console’s internal testing - Check that app is installed from
Play Store, not sideloaded - Use
fetchInstallReferrer()to get fresh data
Best Practices
Event Tracking
- Initialize Early: Call
initialize()as soon as possible in your app lifecycle - Handle App Resume: Always call
onAppResume()when the app becomes active - Deep Link Handling: Use
onNewURL()for all incoming deep links - Error Handling: Wrap SDK calls in try-catch blocks
Performance
- Batch Operations: Avoid calling tracking methods in tight loops
- Background Processing: SDK handles background processing automatically
- Network Optimization: SDK batches events for optimal network usage
Next Steps
iOS SDK
Integrate with native iOS apps.
Android SDK
Integrate with native Android apps.
Deep Linking
Set up deep linking for seamless navigation.
Analytics
Understand your analytics data.
Need help with the React Native SDK? Check our API
documentation or contact
[email protected].