Testing Google Play Install Referrer Library
Solution 1
There's one old hack to test this.
Steps:
-
Start Google Play on the device using campaign link, for example, https://play.google.com/store/apps/details?id=com.test.test_project&referrer=utm_source%3Dtest_source%26utm_medium%3Dtest_medium%26utm_term%3Dtest-term%26utm_content%3Dtest_content%26utm_campaign%3Dtest_name (You can use google play generator: https://developers.google.com/analytics/devguides/collection/android/v3/campaigns#google-play-url-builder)
-
DON'T TAP ON INSTALL BUTTON
-
Install your test build using adb.
adb install -r app-debug.apk
Google Play will be returning your test campaign now.
Solution 2
This is the summary of my test:
- old broadcast way can test.But it's deprecated and not support for now
- U can test install referrer lib set up by use adb,and you will get utm_source=google-play&utm_medium=organic just like download form Google Play directly. But we can't get more info, it's can only test your library settings is correct
-
https://stackoverflow.com/a/60342463/12716149 by @Quickern.To be honest, it works follow these tips
- ensure that the application ID is the same.
- Open via browser on computer(if on your phone, make sure in browser): https://play.google.com/store/apps
- Find and click an app which u want to use. U will saw a url in address bar. e.g. https://play.google.com/store/apps/details?id=com.google.android.youtube
- Set the "id"(com.google.android.youtube) as your app Application Id
- Open test url directly by Google Play app(don't download)
- https://developers.google.com/analytics/devguides/collection/android/v4/campaigns#google-play-url-builder build test url. Application ID must be your test app id.if you can't see the builder, maybe the reason is your browser extensions
- past the url on your phone where click can open by Google play app directly. If don't open by Google Play app directly, will received(not20%set).So, directly by Google play app is the key
- Use adb install your test app
- Open your app and your will received what you set in the url
- ensure that the application ID is the same.
- Use Beta test provided by Google Play: https://stackoverflow.com/a/49750758/12716149. Without a doubt, it works
- Use emulator:https://stackoverflow.com/a/59744213/12716149 @Marilia. I didn't test this, because emulator with Google Play Store is just like a real device.And the answer said the condition is upload app to Google Play store,so I think it's just like article 4
Solution 3
I was able to test the Play Install Referrer Library using the emulator. Uninstalling the app and running it again would start a connection and give me the expected responseCode
in onInstallReferrerSetupFinished
.
Solution 4
Step 1
Step 2 Click on the above link. Open Play store (Don't Install from play Store)
Step 3 Install from Android studio. You get the result. Now if you check another Link you need to follow the above step the same manner bcz,
Note: Caution: The install referrer information will be available for 90 days and won't change unless the application is reinstalled. To avoid unnecessary API calls in your app, you should invoke the API only once during the first execution after install.
Note: My App right now Alpha Version(In Play Store)
Bart Kerfeld
Updated on July 02, 2022Comments
-
Bart Kerfeld almost 2 years
I'm looking to migrate from listening to the Play Store's INSTALL_REFERRER intent, to using the new Google Play Install Referrer Library.
I am struggling to find a way to test this new library without first having to add my app to the Play Store. When listening for the INSTALL_REFERRER intent via a BroadcastReceiver, I could test by manually sending a broadcast via the Activity Manager to mimic the behavior. That is to say, I could test by following these steps from Google.
Does there also exist a way I can test this new library without having to first put my app on the Play Store?
-
Yingbo Miao about 5 yearsAbove is just a "example" code, but didn't show how to test the APP before uploading to the play store.
-
riper about 5 years@YingboMiao True, however if you have the possibility to upload to play store, do you know if you can test it for all tracks (internal, alpha, beta, production) or just some?
-
Peter Keefe over 4 yearsThis tests using the deprecated broadcast receiver, NOT the new Play Install Referrer API.
-
Darshan Pania over 4 yearsCan you help with testing the library way ?
-
weizenberg over 4 yearsThe only way to test it should be using the Beta release feature in the Play Store console. Launch beta testing to your device, and use the beta link to inject the referral parameters. I used firebase analytics to log the referral data as a custom event, so you can check if the data received correctly using the Firebase Analytics Debug dashboard.
-
Mohanakrrishna over 4 yearsBut all the emulators won't have play store app right? Then how can we test them?
-
Marilia over 4 yearsTo test the case when the Play Store is disabled, you can disable the Google Play Store in the settings. Go to Settings > Tap Apps & notifications. Choose Google Play Store (or first tap See all apps or App info to find it). Tap Disable option. If the Google Play Store is disabled I receive
InstallReferrerResponse.FEATURE_NOT_SUPPORTED
asresponseCode
. -
Mohanakrrishna over 4 yearsThanks. I did accordingly and I am able to see the response codes.
-
Mohanakrrishna over 4 yearsbtw did you try to mock the procedure of your app installing from an add and then after opening your app from play store, are you able to monitor the
installReferrerUrl
params likeutm_source
orutm_medium
? -
Marilia over 4 yearsI didn't try installing from an ad, but installing from the play store gives me those parameters in the
referrerUrl
, like for example:utm_source=google-play&utm_medium=organic
-
Mohanakrrishna over 4 yearsInstall from play store means you uploaded to or updated your app on the play store?
-
Marilia over 4 yearsYes, organic source installs or building the app to the emulator should return those parameters and values I mentioned.
-
Islam Ahmed about 4 yearsYes it is working , But be careful utm_source will give you (not%20set) if your link didn't redirect you to google play app directly .
-
Kevin Barron almost 4 yearsOnce you insall via adb you should see the Install button change to an "Open" button. You have to open the app via the button (not using adb am) to get the UTM payload. If you don't see the button text change it is because the application id of the installed app is not the same as the one in play store. This is likely if you release a 'prod' flavor of your app but are working with a 'debug' flavor, temporarily change your debug app's application id and the above should work!
-
Bipin Bharti almost 3 yearsYes, this work but why install from adb?
-
Shlomi Katriel over 2 yearsBuild + install from AS UI creates an APK with
android:testOnly
flag, which cannot be tested in that regard. only using gradle'sassembleDebug
task then install manually with adb worked (for me at least). -
Uriel Frankel about 2 years@ShlomiKatriel Toda Achi!
-
Marline about 2 yearsBe careful which email you are signed into on play store and on test device. If you are logged into your developer email (email on app listing), you will get (not set) for utm source and medium. So make sure you are signed into a different email on play store and on the device. The email you use has to be included in your list of testers if you are testing using Alpha or Beta channels.