💡 Pro feature
This functionality is only available on the Pro plan.

You can create a deferred deep link with an additional referrer parameter. This value can be passed either through the Dynalinks console when creating the link or via the Dynalinks REST API.

Once the user installs your app through the Play Store, you can retrieve the referrer value using Google Play Install Referrer Library. Here’s how to read it:

  1. Add the dependency in your build.gradle:
    implementation 'com.android.installreferrer:installreferrer:2.2'
    
  2. Read the referrer in your app code:
    private lateinit var referrerClient: InstallReferrerClient
       
    referrerClient = InstallReferrerClient.newBuilder(this).build()
    referrerClient.startConnection(object : InstallReferrerStateListener {
    
     override fun onInstallReferrerSetupFinished(responseCode: Int) {
         when (responseCode) {
             InstallReferrerResponse.OK -> {
                 // Connection established.
             }
             InstallReferrerResponse.FEATURE_NOT_SUPPORTED -> {
                 // API not available on the current Play Store app.
             }
             InstallReferrerResponse.SERVICE_UNAVAILABLE -> {
                 // Connection couldn't be established.
             }
         }
     }
    
     override fun onInstallReferrerServiceDisconnected() {
         // Try to restart the connection on the next request to
         // Google Play by calling the startConnection() method.
     }
    })
    

After you have established a connection to the Play Store app, get the details from the install referrer by completing the following steps:

   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

If you’re using React Native, there’s a dedicated package that wraps this functionality: react-native-play-install-referrer. You can install it via npm and follow the instructions in the README to access the referrer data from JavaScript.

This lets you persist attribution or campaign info from a deferred link.