2

can anyone explain if there is any way to get the Referrer parameter value if user is redirecting to playstore on my App through mobile browser(specially chrome).

sam
  • 128
  • 9

2 Answers2

1

Yes there is. Google Analytics for Android has the capability to track install referrals provided that the user downloaded via a trackable link.

https://developers.google.com/analytics/devguides/collection/android/v4/campaigns

If you implement GA in your app and use their url builder you can easily generate a trackable link that you can post online or in advertisements.

For example: https://play.google.com/store/apps/details?id=com.example.application&referrer=utm_source%3Dgoogle%26utm_medium%3Demail%26anid%3Dadmob

Shmuel
  • 3,916
  • 2
  • 27
  • 45
  • for this i need to integrate google analytic sdk first..right? Is there any other option other than to integrate SDK? – sam Mar 16 '16 at 13:19
  • no. you need to add the google analytics package of google play services to your project for this to work – Shmuel Mar 16 '16 at 16:38
  • I appreciate your suggestion but my concerned is little bit different i have explained it in the comment section of above thread. Please check – sam Mar 18 '16 at 07:11
1

If you don't want to use Google Analytics you can also obtain the referrer manually.

After the installation of the app the system issues a Broadcast which you can receive with a custom BroadcastReceiver.

Broadcast Receiver:

public class InstallReferrerBroadcastReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        String installReferrer = intent.getStringExtra("referrer");
    }
}

Manifest Declaration:

<receiver
    android:name="yourpackage.InstallReferrerBroadcastReceiver"
    android:exported="true">
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
    </intent-filter>
</receiver>
dthulke
  • 949
  • 9
  • 23
  • This is already implemented in my App and its working fine. But my requirement is to detect browser if my app is installed then it directly opens my app and i can receive the data through deep-link whatever may be shared on deep-link Intent and in case Intent unable to find my app package then it should redirect to play-store to install my package with some value on Referrer parameter. Still i am not able to find any solution to this. Any help – sam Mar 18 '16 at 05:18
  • If I understand you correctly you want to pass a parameter to your app. If the app is installed it should open directly otherwise the play store page should open, is this correct? This would be a different question. Have a look at following question whether it fits your needs: http://stackoverflow.com/q/28744167/5199788 – dthulke Mar 20 '16 at 17:45