Page MenuHomePhabricator

Implement intent handler for Install Referrer.
Closed, ResolvedPublic2 Estimated Story Points

Description

Based on the results of spike T102290, it's possible for the app to receive a payload from the Play Store after installation, which can consist of parameters that were passed through a URL from a download link on the mobile website. To receive this data, the app needs to implement a handler for the INSTALL_REFERRER intent:
https://developers.google.com/android/reference/com/google/android/gms/tagmanager/InstallReferrerReceiver

The structure for the "referrer" parameter shall be as follows:

referrer_url=foo&campaign_id=bar&install_id=baz
  • referrer_url -- the original url from which the link was clicked.
  • campaign_id -- unique ID that represents the campaign that led to the install of the app. Used for sorting installs based on campaign.
  • install_id -- unique ID that is generated on the Mobile Web page for every click of the link to the Play Store. This unique ID can be sent to eventlogging by the Mobile Web page, and then sent by the app upon receipt of these install referrer parameters, so that we can correlate the two.

The above parameters should be urlencoded and passed as the "referrer" query parameter in the web link that points to the Play Store page for installing the app.

A corresponding event logging schema to accommodate this data has been created:
https://meta.wikimedia.org/wiki/Schema:MobileWikiAppInstallReferrer

The app will send an event whenever it receives this intent, which should be once per install.

Event Timeline

Dbrant raised the priority of this task from to Medium.
Dbrant updated the task description. (Show Details)
Dbrant subscribed.

To test the sending of this intent (via adb):

$ am broadcast -a com.android.vending.INSTALL_REFERRER -n org.wikipedia.alpha/org.wikipedia.analytics.InstallReferrerReceiver --es "referrer" "referrer_url=foo&campaign_id=bar&install_id=baz"

Change 223320 had a related patch set uploaded (by Dbrant):
Implement intent handler for Install Referrer.

https://gerrit.wikimedia.org/r/223320

Thanks for the am command above. Others, note you need to adjust it if you use a different app flavor. Here is an example for the Dev app:

adb shell am broadcast -a com.android.vending.INSTALL_REFERRER -n org.wikipedia.dev/org.wikipedia.analytics.InstallReferrerReceiver --es "referrer" "referrer_url=foo&campaign_id=bar&install_id=buzz"

Change 223320 merged by jenkins-bot:
Implement intent handler for Install Referrer.

https://gerrit.wikimedia.org/r/223320

Note: to test this fully, we'll need to wait until this is deployed to Beta, then go through the actual Play Store install process (via a web link with a referrer parameter).

hey @Pcoombe - here's the parameters for the Android tracking. We'll need to pass these in the banner for the Finland test.

Niedzielski subscribed.

Confirmed with Bernd's test command on API 22 emulator.

Successfully tested with an actual install from the Play Store with the latest Beta that we've just released!
Used the following link to direct to the Play Store:

https://play.google.com/store/apps/details?id=org.wikipedia.beta&referrer=referrer_url%3Dtestreferrer%26campaign_id%3Dtestcampaign%26install_id%3Dtestinstallid

\o/