How does Android app installation tracking work?

can anyone explain how android link tracking works? friend gave me google play referral url android app. And I installed the application and opened it. How does the application developer know that this is my friend who directed me to his application? I know that the link that my friend gave me contains his referral data, but if I close the Google game after the application is installed, how can Google Play detect that I opened the application? Therefore, some unique data is entered into the application when I install it from the game store. I'm right? Explain, please.

+4
source share
2 answers

It is pretty simple. You click on the referral link (Google calls them Campaing Attribution), and that link is transferred to the Google Play Store app. Then, when you install the application, the Play Store also sends this data (campaign name, source, etc.) to the application itself.

An application simply needs to have a specific BroadcastReceiver(with intent-filterfor action com.android.vending.INSTALL_REFERRER) declared in its manifest for this to work.

This is well explained in the Google Play Campaign Attribution section of the Google Analytics documentation.

+9
source

Here is an example of how you can implement a custom BroadcastReceiver with INSTALL_REFERRER.

AndroidManifest.xml

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

ManyInstallTrackersReceiver.java

import com.google.android.gms.tagmanager.InstallReferrerReceiver;

public class CustomInstallTrackersReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        try {
            // Implementing Google Referrer tracker
            InstallReferrerReceiver googleReferrerTracking = new InstallReferrerReceiver();
            googleReferrerTracking.onReceive(context, intent);

            // Do something with referrer data to do your own tracker.
            Log.d("CustomInstallTrackers", "Referrer: "+intent.getStringExtra("referrer"));
        } catch(Exception e){
            e.printStackTrace();
        }
    }
}

$ adb shell
$ am broadcast -a com.android.vending.INSTALL_REFERRER -n com.your.package/com.your.package.CustomInstallTrackersReceiver --es "referrer" "hello%3Dworld%26utm_source%3Dshell"
+4

Source: https://habr.com/ru/post/1544620/


All Articles