Installation handler sometimes don't trigger first, or works slowly
We are using several analytics services in our app, and we are sending "Install App" event not only to AppsFlyer, but other services as well. But the problem is that these events sometimes are sent after other events, what creates misunderstanding and breaks order of events.
Report
Plugin Version
react-native-appsflyer: ^6.8.0
AppsFlyerFramework (6.8.0)
On what Platform are you having the issue?
Tested only with iOS
6.8.0
What did you expect to happen?
Installation callback triggers before anything happens.
For example:
- log install event;
- log other events;
What happened instead?
Install callback don't trigger first
Please provide any other relevant information.
Exploring this issue from react-native-appsflyer: ^6.5.21
Code
App.js:
componentDidMount() {
this.onInstallConversionDataCanceller = appsFlyer.onInstallConversionData(res => {
if (JSON.parse(res.data.is_first_launch) == true) {
if (res.data.af_status === 'Non-organic') {
const adSet = res.data.af_adset;
const adName = res.data.af_ad;
const campaign = res.data.campaign;
const mediaSource = res.data.media_source;
const payload = {
adSet,
adName,
campaign,
mediaSource,
};
logInstallApp(payload);
} else if (res.data.af_status === 'Organic') {
logInstallApp({}); // this triggers secondly
}
}
});
appsFlyer.initSdk({
devKey: 'xxx',
isDebug: false,
appId: 'xxx',
onInstallConversionDataListener: true,
onDeepLinkListener: true,
});
logOtherEvent(); // this triggers firstly
}
can you share code snippet of how and where you implemented the init and logevent(if implemented) in your code?
@amit-kremer93 I added code snippet
@amit-kremer93 I updated issue name and description to make it more understandable
The calls are asynchronous, so sometimes the response of gcd (onInstallConversionData, which is the result of initSdk) can occur after your method logOtherEvent is called.