deeplink-rn
v0.2.5
Published
Zero-code install attribution SDK for React Native (Android)
Readme
deeplink-rn – Install Attribution & Deep Links (Android)
deeplink-rn is a zero-code install attribution and deep-link tracking SDK for React Native (Android).
It:
- Tracks Play Store installs and basic device/app info.
- Sends an initial "app open" event (optionally with FCM token).
- Sends every deep link your Android app receives to your backend.
1. Installation
Install the package in your React Native app:
npm install deeplink-rn
# or
yarn add deeplink-rnIf you are developing locally and the SDK lives next to your app:
npm install ../deeplink-rn
# or
yarn add ../deeplink-rnThen rebuild your native app so the native module is linked:
# iOS (no-op for this SDK but required after adding any native module)
cd ios && pod install && cd ..
npx react-native run-ios
# Android (required)
npx react-native run-androidNote: The native Android module is called
InstallAttribution. If the app is not rebuilt, JS will throw:deeplink-react-native: Native module not found. Did you rebuild the app after installing the package?
2. Basic usage (passing your API key)
Call configure once at app startup, after the root component is mounted / app has an Activity:
// index.js or App.tsx
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
// Option 1: default export
import InstallAttribution from 'deeplink-rn';
InstallAttribution.configure({
apiKey: 'YOUR_API_KEY_HERE', // required – string
// endpoint: 'https://your-api.example.com', // optional override
});
AppRegistry.registerComponent(appName, () => App);You can also use the named export:
import {configure as configureInstallAttribution} from 'deeplink-rn';
configureInstallAttribution({
apiKey: 'YOUR_API_KEY_HERE',
});configure parameters
apiKey(string, required)
Used as theX-API-Keyheader for all tracking calls. If missing or blank, JS / native will throw or reject.endpoint(string, optional)
Optional override for the base URL. If omitted, the SDK uses its built‑in endpoints.
Internally, configure calls the native InstallAttribution.init(context, apiKey, intent) which:
- Tracks install referrer (Play Store vs sideload).
- Sends an initial connection event with device/app metadata (and optional FCM token).
- Processes the launch deep link (if any) from the current
Activityintent.
3. Android deep-link configuration
To send deep links to the SDK, your main Activity must declare a view intent filter.
For example, in your app AndroidManifest.xml:
<activity
android:name=".MainActivity"
android:launchMode="singleTask"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- Deep link: https://link.invyto.in/ -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="link.invyto.in"
android:pathPrefix="/" />
</intent-filter>
</activity>When such a link opens your app, the SDK reads intent.data and sends it to the backend with your apiKey.
Tip: Adjust
android:hostandandroid:pathPrefixto match your own link domain and path.
4. When configure should be called
- Call
configureafter the React Native app has an attachedActivity.
If called too early, the native side may reject withNO_ACTIVITY. - Typically, putting it in
index.jsor at the top of your root component is sufficient.
The SDK caches the last used apiKey so it can handle subsequent deep links while the app is running.
5. Troubleshooting
Native module not found
Rebuild the app after installing the package:cd android && ./gradlew clean && cd ..npx react-native run-android
NO_ACTIVITYerror
Ensure you callconfigureafter the app has started (e.g., not from extremely early bootstrap code).No deep links received
Check that:- Your
AndroidManifest.xmlhas the correct<intent-filter>for your domain. - You are opening a URL that matches the scheme/host/pathPrefix.
- Your
