Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test android referral tracking?

I'm implementing some code to do my own referral tracking on downloads from the Android market.

See Android referral tracking does not work for an idea of what my app is doing.

How can I test if this code is working before deploying to the public?

like image 670
emmby Avatar asked May 04 '11 23:05

emmby


People also ask

How do I test Google install referrer?

If all goes well, you should be able click the generated URL on your Android device, go to the Play store, install the "Referrer Test for Google Play" application, run the application, and see the referrer string you entered on this site show up in the log within the application.

How do I track an app download referrals?

It can be done using Google Campaign Measurement where in the utm_source just give unique number/string for each user which you will receive when user's friend installs the app as Google Play store will broadcast it after the installation.


2 Answers

The easiest way is using adb. You don't have to write any code.

Just run in a terminal:

adb shell  am broadcast -a com.android.vending.INSTALL_REFERRER -n <your.package>/.<path.up.until.your.BroadcastReceiver> --es "referrer" "utm_source=test_source\&utm_medium=test_medium\&utm_term=test_term\&utm_content=test_content\&utm_campaign=test_name" 

Here's my exact line:

am broadcast -a com.android.vending.INSTALL_REFERRER -n net.lp.collectionista/.util.broadcast_receivers.FacadeBroadcastReceiver --es "referrer" "utm_source=test_source\&utm_medium=test_medium\&utm_term=test_term\&utm_content=test_content\&utm_campaign=test_name" 

But your BroadcastReceiver may need to be the AnalyticsReceiver, i.e.

For Google Analytics v2:

com.your.package/com.google.analytics.tracking.android.CampaignTrackingReceiver

For Google Analytics v3:

com.your.package/com.google.android.apps.analytics.AnalyticsReceiver

For Google Analytics v4:

com.your.package/com.google.android.gms.analytics.CampaignTrackingReceiver

As Luigi said, you can also leave out the "-n" componentname part, but then every app on your device will receive the referral. This can be a good extra test to see if your BroadcastReceiver can be found properly.

The output I see (especially the last line is important):

05-13 17:28:08.335: D/Collectionista FacadeBroadcastReceiver(8525): Receiver called 05-13 17:28:08.335: V/Collectionista FacadeBroadcastReceiver(8525): Receiver called with action: com.android.vending.INSTALL_REFERRER 05-13 17:28:08.365: D/GoogleAnalyticsTracker(8525): Stored referrer:utmcsr=test_source|utmccn=test_name|utmcmd=test_medium|utmctr=test_term|utmcct=test_content 
like image 114
pjv Avatar answered Oct 21 '22 13:10

pjv


No! you have a few way to test it Send a broadcast manually with an intent of this form

    Intent i = new Intent("com.android.vending.INSTALL_REFERRER");     //Set Package name     i.setPackage("com.package.yourapp");     //referrer is a composition of the parameter of the campaing     i.putExtra("referrer", referrer);     sendBroadcast(i); 
like image 44
Luigi Agosti Avatar answered Oct 21 '22 14:10

Luigi Agosti