Skip to content

Configuration

Install affise-attribution-lib with your package manager of choice:

Terminal window
npm install affise-attribution-lib
Terminal window
yarn add affise-attribution-lib

pod-install is a dev dependency of the SDK (package.json:69) and the bootstrap script runs yarn example pods (package.json:36). From your app’s ios/ directory:

Terminal window
pod install

The SDK pod depends on React-Core and AffiseInternal at 1.7.8 (affise-attribution-native.podspec:19-20). Add module subspecs as needed:

target 'YourAppProject' do
# ...
affise_version = '1.7.8'
# Affise Modules
pod 'AffiseModule/AdService', affise_version
pod 'AffiseModule/Advertising', affise_version
pod 'AffiseModule/AppsFlyer', affise_version
pod 'AffiseModule/Link', affise_version
pod 'AffiseModule/Persistent', affise_version
pod 'AffiseModule/Status', affise_version
pod 'AffiseModule/Subscription', affise_version
pod 'AffiseModule/TikTok', affise_version
end

The SDK’s own AndroidManifest.xml declares no permissions (android/src/main/AndroidManifest.xml:1-5); your app must declare internet access:

<manifest>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>

Android dependency coordinates for the native SDK and install-referrer are declared at android/build.gradle:73-82. Add optional module artifacts to your app-level build.gradle:

final affise_version = '1.7.8'
dependencies {
// Affise modules
implementation "com.affise:module-advertising:$affise_version"
implementation "com.affise:module-androidid:$affise_version"
implementation "com.affise:module-link:$affise_version"
implementation "com.affise:module-network:$affise_version"
implementation "com.affise:module-phone:$affise_version"
implementation "com.affise:module-status:$affise_version"
implementation "com.affise:module-subscription:$affise_version"
implementation "com.affise:module-meta:$affise_version"
implementation "com.affise:module-rustore:$affise_version"
implementation "com.affise:module-huawei:$affise_version"
implementation "com.affise:module-appsflyer:$affise_version"
implementation "com.affise:module-tiktok:$affise_version"
}

If you use the Meta Install Referrer module, add a <queries> block to your app manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<queries>
<package android:name="com.facebook.katana" />
<package android:name="com.instagram.android" />
<package android:name="com.facebook.lite" />
</queries>
<application>
...
</application>
</manifest>

The Affise Advertising module uses the AppTrackingTransparency framework to read advertisingIdentifier. Add a usage description to your Info.plist:

<plist version="1.0">
<dict>
...
<key>NSUserTrackingUsageDescription</key>
<string>Youre permission text</string>
</dict>

Call Affise.settings(...).start() once at app startup:

import {
Affise,
AffiseInitProperties
} from 'affise-attribution-lib';
export default function App() {
React.useEffect(() => {
Affise
.settings({
affiseAppId: 'Your appId', //Change to your app id
secretKey: 'Your SDK secretKey', //Change to your SDK secretKey
})
.start(); // Start Affise SDK
});
return (
<SafeAreaView>
</SafeAreaView>
);
}

The builder entry point is Affise.settings({ affiseAppId, secretKey }) (src/index.ts:42-44) which returns an AffiseSettingsApi. Calling .start() (src/settings/AffiseSettingsApi.ts:89) triggers AffiseSettings.start() (src/settings/AffiseSettings.ts:174-176), which forwards init properties to native via AffiseNative.init(initProperties) (src/native/AffiseNative.ts:35-54).

For init callbacks, custom domain, production flag, config values and module gating, see optional setup.