How to get referrer code from playstore using Play Install Referrer Library?

I'm going to use Referrer Library

I have read many articles, but none of them tell you how to create a link

for example, I have the code "KSK23DG" What should the link look like so that I can get it in my application?

https://play.google.com/store/apps/details?id=<apppid>...

val response: ReferrerDetails = referrerClient.installReferrer
val referrerUrl: String = response.installReferrer
val referrerClickTime: Long = response.referrerClickTimestampSeconds
val appInstallTime: Long = response.installBeginTimestampSeconds
val instantExperienceLaunched: Boolean = response.googlePlayInstantParam

Upvotes: 6

Views: 6354

Answers (1)

Alexander Hoffmann
Alexander Hoffmann

Reputation: 6014

Check out my answer here.

Passing data to Google Play Store

You can pass in referrer data with the referrer URL query parameter:

One of your links could look like this (replace com.example.myapp with your real application ID):

https://play.google.com/store/apps/details?id=com.example.myapp&referrer=someid%3Dsomedata

This URL consists of the following parts:

  • Base URL for the store page of an app on the Google Play Store:
    • https://play.google.com/store/apps/details?id=
  • Your application ID:
    • com.example.myapp
  • referrer URL parameter:
    • &referrer=
  • Your freely choosable key-value data. In this case with someid as a key and somedata as a value (note, that %3D is the HTML URL enconding for =):
    • someid%3Dsomedata

Testing

In order to test this, you will need to upload your app to the Play Store into the internal, alpha, beta or production track. As far as I am aware, this does not work with internal app sharing.

Upvotes: 13

Related Questions