Expo
Add Fload's attribution package to an Expo app. It's the same package as for React Native. It needs native code, so it runs in development builds and store builds, not in Expo Go.
What you need
- A development build (EAS Build or
npx expo run), or a project you manage withnpx expo prebuild. - iOS 15.1 or later, and Android minSdk 24 or later.
- Your app's write key.
react-native-purchasesin your app, if you want revenue per keyword.
1. Install the package
npx expo install @fload-ai/attribution-react-nativeYou don't need a config plugin. The SDK needs no Info.plist keys, entitlements or Gradle changes. Autolinking adds it the next time you build.
Use this package or the native iOS SDK in an app, not both. The package already contains the iOS SDK, so don't also add the Swift package or pod.
2. Make a new build
The package adds native code, so build again:
# With EAS
eas build --profile development
# Or locally
npx expo run:ios
npx expo run:android3. Start it at app start
Call FloadAttribution.configure once, as your app starts. With Expo Router, the root app/_layout.tsx is a good place.
import { useEffect } from 'react';
import { Platform } from 'react-native';
import { Stack } from 'expo-router';
import { FloadAttribution } from '@fload-ai/attribution-react-native';
import Purchases from 'react-native-purchases';
export default function RootLayout() {
useEffect(() => {
Purchases.configure({
apiKey: Platform.OS === 'ios' ? 'appl_…' : 'goog_…',
});
FloadAttribution.configure('fload_pk_…');
Purchases.getAppUserID().then((id) => FloadAttribution.setUserId(id));
}, []);
return <Stack />;
}After a login, call FloadAttribution.setUserId again with RevenueCat's new app user id.
In Expo Go
Expo Go can't load custom native code, so every call does nothing there. The package logs one warning to say so, and your app runs as usual. Use a development build to test it.
4. Ship it
Build for the stores with EAS and submit. An over-the-air update can't add native code, so it can't add the SDK: it needs a new store build. Fill in the App Store privacy answers and the Play Data safety form from Privacy.