Testing Google Play Install Referrer Library

11,983

Solution 1

There's one old hack to test this.

Steps:

  1. 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)

  2. DON'T TAP ON INSTALL BUTTON

  3. 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:

  1. old broadcast way can test.But it's deprecated and not support for now
  2. 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
  3. https://stackoverflow.com/a/60342463/12716149 by @Quickern.To be honest, it works follow these tips
  4. Use Beta test provided by Google Play: https://stackoverflow.com/a/49750758/12716149. Without a doubt, it works
  5. 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

Testing Url
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

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.

(From Here)

Note: My App right now Alpha Version(In Play Store)

Share:
11,983
Bart Kerfeld
Author by

Bart Kerfeld

Updated on July 02, 2022

Comments

  • Bart Kerfeld
    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
    Yingbo Miao about 5 years
    Above is just a "example" code, but didn't show how to test the APP before uploading to the play store.
  • riper
    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
    Peter Keefe over 4 years
    This tests using the deprecated broadcast receiver, NOT the new Play Install Referrer API.
  • Darshan Pania
    Darshan Pania over 4 years
    Can you help with testing the library way ?
  • weizenberg
    weizenberg over 4 years
    The 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
    Mohanakrrishna over 4 years
    But all the emulators won't have play store app right? Then how can we test them?
  • Marilia
    Marilia over 4 years
    To 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 as responseCode.
  • Mohanakrrishna
    Mohanakrrishna over 4 years
    Thanks. I did accordingly and I am able to see the response codes.
  • Mohanakrrishna
    Mohanakrrishna over 4 years
    btw 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 like utm_source or utm_medium?
  • Marilia
    Marilia over 4 years
    I 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
    Mohanakrrishna over 4 years
    Install from play store means you uploaded to or updated your app on the play store?
  • Marilia
    Marilia over 4 years
    Yes, organic source installs or building the app to the emulator should return those parameters and values I mentioned.
  • Islam Ahmed
    Islam Ahmed about 4 years
    Yes 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
    Kevin Barron almost 4 years
    Once 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
    Bipin Bharti almost 3 years
    Yes, this work but why install from adb?
  • Shlomi Katriel
    Shlomi Katriel over 2 years
    Build + install from AS UI creates an APK with android:testOnly flag, which cannot be tested in that regard. only using gradle's assembleDebug task then install manually with adb worked (for me at least).
  • Uriel Frankel
    Uriel Frankel about 2 years
    @ShlomiKatriel Toda Achi!
  • Marline
    Marline about 2 years
    Be 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.