React Native SDK
Add install and purchase attribution to your React Native app with a single npm package.
Prerequisites
- React Native 0.70 or later
- An Instally account with an App ID and API Key (available at app.instally.io)
Step 1: Install the package
Install the Instally React Native package from npm:
Terminal
npm install instally-react-nativeIf you use Yarn:
Terminal
yarn add instally-react-nativeiOS: run pod install
After installing the package, run
cd ios && pod install to link the native iOS dependency.Step 2: Configure and track install
Initialize the SDK in your app's root component or entry point. Replace the placeholder values with the App ID and API Key from your Instally dashboard.
App.tsx (functional component)
App.tsx
import React, { useEffect } from 'react';
import { instally } from 'instally-react-native';
function App() {
useEffect(() => {
async function initInstally() {
instally.configure({ appId: 'YOUR_APP_ID', apiKey: 'YOUR_API_KEY' });
await instally.trackInstall();
}
initInstally();
}, []);
return (
// Your app content
);
}
export default App;index.js (entry point)
index.js
import { AppRegistry } from 'react-native';
import { instally } from 'instally-react-native';
import App from './App';
import { name as appName } from './app.json';
instally.configure({ appId: 'YOUR_APP_ID', apiKey: 'YOUR_API_KEY' });
instally.trackInstall();
AppRegistry.registerComponent(appName, () => App);Step 3: Track purchases (optional)
To attribute revenue to referrers, call trackPurchase() after every successful in-app purchase.
PurchaseHandler.tsx
import { instally } from 'instally-react-native';
async function handlePurchase(purchase: Purchase) {
// After verifying the purchase was successful:
await instally.trackPurchase({
productId: purchase.productId,
revenue: 9.99,
currency: 'USD',
transactionId: purchase.transactionId,
});
}Works with any IAP library
The Instally SDK is compatible with popular in-app purchase libraries like
react-native-iap and expo-in-app-purchases. Just call trackPurchase() after a successful transaction from any library.Important notes
No special permissions required
The Instally SDK does not use IDFA on iOS or advertising IDs on Android. No ATT prompt is needed. Attribution is handled through deterministic matching.
trackInstall()is safe to call on every app launch. It only fires once per install.trackPurchase()should be called after every successful in-app purchase.- The SDK is under 200 KB with zero external dependencies.
- Works alongside any other analytics or attribution provider.