Tracking how users install your app can be tricky, especially when you want to measure the effectiveness of your campaigns or ads. That’s where the Google Play Install Referrer API comes in handy—it gives you reliable data about how users found your app.
If you’re developing an Android application, this guide will walk you through how to set up and use the InstallReferrerClient with Kotlin’s callbackFlow to make integration simpler and more maintainable.
What is the Install Referrer?
The install referrer contains information about the source of the app installation. For example, if a user clicks an ad campaign link that leads to your app’s Play Store page, the referrer might include details about the campaign source, medium, or other specifics.
Here’s how this data can help:
Attribution: Identify which campaigns drive installs.
Measure Success: Evaluate your marketing efforts’ impact.
Prevent Fraud: Verify referrer data to avoid fraudulent installs.
Setting Up and Using the InstallReferrerClient
Step 1: Add the Dependency
First, include the Install Referrer library in your build.gradle file: