7

I have an app which is linked to (via an Android Market URL) on several different websites. What I need to implement is a way to determine where my users came from. Is there a way to determine the referring URL that the user followed to download my app via the Android Market?

For example, user A browses site xyz.com and clicks the link to view my app on the Android Market and then proceeds to download it. Once installed can I "programmaticaly" see where the user came from (xyz.com)?

I need to implement this myself (within the app) and not rely on external tools or services.

Janusz
  • 187,060
  • 113
  • 301
  • 369
Mikey
  • 73
  • 1
  • 3

2 Answers2

3

It is possible to use Google Analytics to track the usage of your App.

On Android Google Analytics provides a refferal tracking. This should enable you to create a link for each of the sites that link to your app and track how much apps where installed because of which site.

Look at the Tracking Referrals chapter from the Android Google Analytics Documentation for more information.

You have to rely on the Google Analytics jar that has to be called within the app and registered in the manifest.xml

Update

If you don't want to use a separate jar you could try to obtain the referral information yourself. Google analyticss work through registering this Intent filter:

<!-- Used for install referrer tracking -->
<receiver android:name="com.google.android.apps.analytics.AnalyticsReceiver" android:exported="true">
  <intent-filter>
    <action android:name="com.android.vending.INSTALL_REFERRER" />
  </intent-filter>
</receiver>

It seems that the market app will send the specified intent just after installing an app from the market. The intent then will be catched from the AnalyticsReciever class and they will save the referrer for later use in the analytics.

Google states that this is how it works:

The Android 1.6 OS release supports the use of a referrer URL parameter in download links to the Android Market. The Google Analytics SDK for Android uses this parameter to automatically populate referral/campaign information in Google Analytics for your application. This enables the source of the application install to be recorded and associated with future pageviews and events.

This also means that the sites linking to you app have to include a specific parameter in the market url. How this is done is also explained in the Google Analytics Documentation.

Janusz
  • 187,060
  • 113
  • 301
  • 369
  • How would they do this?? They dont control site xyz.com nor the Android Market. And they can not use Google Analytics for Mobile, since app is not yet installed at that time. – Peter Knego Nov 01 '10 at 15:12
  • I'd be interested to know how Google Analytics can determine the referrer. If I knew how they did it I could just implement it myself. Unfortunately, I cannot rely on external jars. – Mikey Nov 01 '10 at 15:18
  • This is either an answer to the wrong question, or an answer that requires making a different version of the app for each path to installation, and then using analytics to determine the number of installs for each version and thus path. – Chris Stratton Nov 01 '10 at 15:25
  • Your update looks promising, I shall look into this tonight, report back and mark this as answered if it turns out to be the case. Thanks for bringing it to my attention. – Mikey Nov 01 '10 at 15:32
  • @Janusz: This does indeed work as described. I'm reversing my previous comment. +1 for you. – Peter Knego Nov 01 '10 at 20:39
  • @Janusz this doesn't work when the uses the android market from the web to remote download the app on to the phone? Is there an alternative I could use? – Hades Apr 26 '11 at 08:34
  • @Janusz have any idea about referrer tracking with google i have try with my own receiver and checked as given at accepted ans of http://stackoverflow.com/questions/5890914/how-to-test-android-referral-tracking/6966718#comment13505397_6966718 and it works perfact but if i download app from market than it returns nothing my question is at http://stackoverflow.com/questions/10431018/how-to-get-referrer-using-google-track-in-android – Khan May 07 '12 at 09:29
1

Afaik no.

However you could use URL shortening service that remembers HTTP referer, then you would share that URL with the websites. One such service is referer.us.

Or you could roll your own on AppEngine (reliable & free) with HttpRedirectFilter.

Edited:

Pls take a look at @Janusz post. He presented the right solution.

Peter Knego
  • 79,991
  • 11
  • 123
  • 154