我正在尝试在Android中实施Google Analytic广告系列跟踪。我遵循了这个指南:https://developers.google.com/analytics/devguides/collection/android/v2/campaigns
这就是我所做的:
将此添加到AndroidManifest:
<!-- Used for install referral measurement-->
<service android:name="com.google.analytics.tracking.android.CampaignTrackingService"/>
<receiver android:name="com.google.analytics.tracking.android.CampaignTrackingReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
按照本指南(https://developers.google.com/analytics/solutions/testing-play-campaigns)执行广播:
adb shell am broadcast -a com.android.vending.INSTALL_REFERRER -n com.my.app/com.google.analytics.tracking.android.CampaignTrackingReceiver --es "referrer" "utm_source%3Dtest_source%26utm_medium%3Dtest_medium%26utm_term%3Dtest_term%26utm_content%3Dtest_content%26utm_campaign%3Dtest_name"
我检查了logcat,它正确地显示了这一行:
02-12 11:47:13.190: I/GAV3(18963): Thread[GAThread,5,main]: Campaign found: utm_source%3Dtest_source%26utm_medium%3Dtest_medium%26utm_term%3Dtest_term%26utm_content%3Dtest_content%26utm_campaign%3Dtest_name
然而,它还有另外两行:
02-12 11:47:18.280: W/System.err(18963): [DEBUG] GbaRequest - GbaRequest: Constructor Called 222 userAgent Apache-HttpClient/UNAVAILABLE (java 1.4)
02-12 11:47:18.280: W/System.err(18963): [DEBUG] NafRequest - NafRequest: NafRequest constructor===useragent Apache-HttpClient/UNAVAILABLE (java 1.4)
我查看了收据 - &gt; Google Play - &gt;来源下的GA报告页面,它只显示(未设置),(无)或(直接),但不显示source
, medium
等,我希望看到:test_source
,test_medium
等。
任何人都面对这个,知道如何解决?
答案 0 :(得分:0)
广告系列接收者和服务已移至Google Analytics SDK的v2和v4之间的其他包名称。这可能会导致问题。
在v2中,该软件包是com.google.analytics.tracking.android:
com.google.analytics.tracking.android.CampaignTrackingReceiver
com.google.analytics.tracking.android.CampaignTrackingService
在第4版中,该软件包是com.google.android.gms.analytics:
com.google.android.gms.analytics.CampaignTrackingReceiver
com.google.android.gms.analytics.CampaignTrackingService
您应该遵循v4而不是v2的开发指南: https://developers.google.com/analytics/devguides/collection/android/v4/campaigns