如何测试android引荐跟踪?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (2)
  • 关注 (0)
  • 查看 (11)

我正在实施一些代码,以对Android市场的下载进行自己的推介跟踪。

在部署给公众之前,如何测试此代码是否正在运行?

提问于
用户回答回答于

你只需在终端中这样运行

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"

这是我的确切路线:

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"

但你BroadcastReceiver可能需要成为AnalyticsReceiver,即:

对于Google Analytics(分析)v2:

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

对于Google Analytics(分析)v3:

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

对于Google Analytics(分析)v4:

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

我看到的输出(特别是最后一行很重要):

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
用户回答回答于

你有几种方法来测试它:

  1. 使用应用:https//market.android.com/details?id = com.giago.referraltester&feature = search_result
  2. 以此表单的意图手动发送广播: 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);

扫码关注云+社区