appsflyer not called onAppOpenAttribution after first install
Asked Answered
C

2

6

Deferred Deeplinking NOT working. I am using appsflyer, Android 5.1.1, Android Studio 2.3.3

in build.gradle:

compile 'com.appsflyer:af-android-sdk:4.8.3@aar'

in Application:

@Override
public void onCreate() {
    super.onCreate();

    AppsFlyerConversionListener conversionDataListener = new AppsFlyerConversionListener() {
        @Override
        public void onInstallConversionDataLoaded(Map<String, String> conversionData) {
            Log.d(TAG, "onInstallConversionDataLoaded");
            if (conversionData != null) {
                Log.d(TAG, conversionData.toString());
                Log.d(TAG, conversionData.keySet().toString());
                Log.d(TAG, conversionData.values().toString());
            }
        }

        @Override
        public void onInstallConversionFailure(String errorMessage) {
            if (errorMessage == null) {
                Log.d(TAG, "null");
            } else {
                Log.d(TAG, errorMessage);
            }
        }

        @Override
        public void onAppOpenAttribution(Map<String, String> attributionData) {
            Log.d(TAG, "onAppOpenAttribution");
            if (attributionData != null) {
                Log.d(TAG, attributionData.toString());
                Log.d(TAG, attributionData.keySet().toString());
                Log.d(TAG, attributionData.values().toString());
            }
        }

        @Override
        public void onAttributionFailure(String errorMessage) {
            if (errorMessage == null) {
                Log.d(TAG, "null");
            } else {
                Log.d(TAG, errorMessage);
            }
        }
    };

    AppsFlyerLib.getInstance().setDebugLog(true);
    AppsFlyerLib.getInstance().init(AF_DEV_KEY, conversionDataListener);
    AppsFlyerLib.getInstance().startTracking(this, "application");
}

in AndroidManifest.xml

<receiver
        android:name="com.appsflyer.MultipleInstallBroadcastReceiver"
        android:exported="true">
        <intent-filter>
            <action android:name="com.android.vending.INSTALL_REFERRER" />
        </intent-filter>
    </receiver>

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>


        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data
                android:host="detail"
                android:scheme="prayer" />
        </intent-filter>

    </activity>

All about code is these, I public the app to Google Play Store. After the app can been seen, I click https://test5.onelink.me/B3qk?pid=test6&c=test7&af_dp=prayer%3A%2F%2Fdetail%2Ftest2&af_web_dp=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcn.renyuzhuo.testreferrer to download the app, bug I can't get the Attributes.

The very first open app, onInstallConversionDataLoaded is called, and I can see the log is

onInstallConversionDataLoaded
{af_message=organic install, af_status=Organic}
[af_message, af_status]
[organic install, Organic]

and if I click the url after the app is installed, I can see the log is:

onAppOpenAttribution
{af_android_url=https://play.google.com/store/apps/details?id=cn.renyuzhuo.testreferrer, af_deeplink=true, campaign=test7, media_source=test6, install_time=2017-10-24 06:21:29, af_status=Non-organic, path=/test2, scheme=prayer, host=detail}
[af_android_url, af_deeplink, campaign, media_source, install_time, af_status, path, scheme, host]
[https://play.google.com/store/apps/details?id=cn.renyuzhuo.testreferrer, true, test7, test6, 2017-10-24 06:21:29, Non-organic, /test2, prayer, detail]

It is not the same. And after I read the doc https://support.appsflyer.com/hc/en-us/articles/207032176-Accessing-AppsFlyer-Attribution-Conversion-Data-from-the-SDK-Deferred-Deeplinking-. I hope the install by click the url, the very first open can get the Attribution like the click after install.

Where I did wrong? Thank you.

Comprise answered 24/10, 2017 at 7:8 Comment(3)
I can't get Deferred Deeplinking AttributionsComprise
Did you manage to get it to work?Oleaceous
@Oleaceous No. It does not work.Comprise
B
1

From your description it seems you have not whitelisted your test device, as explained here: https://support.appsflyer.com/hc/en-us/articles/207031996--Whitelisting-a-Test-Device

After whitelisting the test device, make sure you remove the application from your phone, before testing once more.

If this is not the case (device is whitelisted, but non-organic conversion data is not returned) please open a support ticket by mailing to [email protected]

Boote answered 25/10, 2017 at 8:15 Comment(3)
Yes, I have add the device to the whitelisting, but it stil not work. Thank you.Comprise
Please check the following method call: AppsFlyerLib.getInstance().startTracking(this, "application"); startTracking can receive either: startTracking(Application application, String "Devkey"); either: startTracking(Application application); The later (passing only Application) is possible in SDK v4.8.0 and higher, if the init method is used (like in your case). So you should correct the call to: AppsFlyerLib.getInstance().startTracking(this);Boote
I encounter a problem when I try this. Add to whitelist works, but after several days, it doesn't trigger any callback. Turns out that you have to launch the Device Id app and login AppsFlyer account again.Volpe
G
0

I was also facing the same issue when using AppsFlyer with Segment in our app. Are you using Segment in your app as well? If yes, then using AppsFlyerConversionListener directly in your code will not work. You have to use it through the Segment wrapper SDK as explained here https://support.appsflyer.com/hc/en-us/articles/210041606#how-does-the-sdk-wrapper-work. Here is some sample code that explains how we can use the wrapper https://github.com/AppsFlyerSDK/AppsFlyer-Segment-Integration/tree/master/segmenttestapp/src/main/java/com/appsflyer/segment/app. You can ask for clarification if it's not clear to you.

Gallant answered 4/11, 2019 at 12:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.