Why the ConversionData of appsflyer is cached?

1.1k views Asked by At

I am developing an ionic app and we have a need of using deeplinks and I am using appsflyer. I call the below mentioned method by passing the devKey and the appID

    // initialize appsflyer
initAppsflyer() {

    var onSuccess = function (result) {
        //handle result
        console.log('Appsflyer onSuccess ' + result);

    };

    var onError = function (err) {
        // handle error
        console.log('Appsflyer onError ' + err);
    }
    var options = {
        devKey: '',
        appId: '',
        isDebug: true,
        onInstallConversionDataListener: true
    };
    window.plugins.appsFlyer.initSdk(options, onSuccess, onError);
}

when I click on a deep link it opens the app and data loads fine. But when I click on another link it shows the data of the previously clicked link. Have anyone faced this issue when working with apssflyer onelink? if so how to over some this issue?

2

There are 2 answers

1
Joe Williams On BEST ANSWER

What you are noticing is that the onInstallConversionDataListener is only meant to return install attribution data and this data doesn't change unless a user uninstalls and reinstalls the app.

To get deeplinking data that updates with each new deeplink URL, please refer to our onAppOpenAttribution method which is meant to return the deeplink details of the link that most recently triggered the app open: https://support.appsflyer.com/hc/en-us/articles/208874366-Deep-Linking-Step-by-Step#the-onappopenattribution-method-

If you have further questions please reach out to [email protected] and we'd be happy to assist you.

Best, Joe Williams AppsFlyer U.S. Support Engineer

4
Maxim Shoustin On

New version (4.4.9) is released that supports additional callback for onAppOpenAttribution: https://github.com/AppsFlyerSDK/cordova-plugin-appsflyer-sdk#registerOnAppOpenAttribution

Also you can find this example (Ionic3) helpful

platform.ready().then(() => {

  // init AppsFlyer
  const options = new AppsFlyerInitOptions();
  options.devKey = AppsFlyerConstants.DEV_KEY;
  options.isDebug = true; // Optional
  options.onInstallConversionDataListener = true;

  if (platform.is('ios')){
    options.appId = AppsFlyerConstants.APP_ID;
  }

  try {
    const onSuccess: Function = (res: any) => {
      // do something with  JSON.parse(res)
    };
    const onError: Function = (err: any) => {
      //..
    };

    const onAppOpenAttributionSuccess: Function = (res: any) => {
      // do something with  JSON.parse(res)
    };
    const onAppOpenAttributionError: Function = (err: any) => {
      //..
    };

    window.plugins.appsFlyer.registerOnAppOpenAttribution(onAppOpenAttributionSuccess, onAppOpenAttributionError);

    window.plugins.appsFlyer.initSdk(options, onSuccess, onError);
  }
  catch (e) {
    console.error("ERROR: AppsFlyer not initiated", e);
  }

 //...
});