Sebastian Nowak
Sebastian Nowak

Reputation: 5717

Android Google Play intent referrer

I'm launching Google Play like this:

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.example"));                                                           
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
startActivity(intent);

I'd like to include referrer data, as explained here: https://developers.google.com/analytics/devguides/collection/android/devguide#google-play-builder Unfortunetely it generates the url which leads to the google play website. What's the equivalent for the intent? I'd be thankful for a sample source code.

Thanks.

Upvotes: 8

Views: 4485

Answers (2)

Arun Kumar
Arun Kumar

Reputation: 100

Please Check have You Mentioned this Receiver in your Manifest file..If it is there You will be get the same. Otherwise,Please add into Manifest file

<receiver android:name="com.google.android.apps.analytics.AnalyticsReceiver" android:exported="true">
  <intent-filter>
    <action android:name="com.android.vending.INSTALL_REFERRER" />
  </intent-filter>
</receiver>

It should be work

Upvotes: -1

awales
awales

Reputation: 596

Adding referrer data to Google Play links works the same for in-app links as it does for the web:

You can add referrer data via a referrer parameter in your market URI, i.e.:

market://details?id=com.example&referrer=utm_source%3Dmyapp%26utm_medium%3Dcross-sell

If the user chooses to then install the app to which you linked, the Google Play app should pass the value of that referrer parameter, if present, as a string extra in the com.android.vending.INSTALL_REFERRER intent during the install.

Note that referrer data is not passed for remote installs initiated from the Google Play Store website.

Upvotes: 4

Related Questions