我正在尝试在
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)
我检查了收购 – > Google Play – >来源下的GA报告页面,它只显示(未设置),(无)或(直接),但不显示源,媒体等我期待的看:test_source,test_medium等
>注意:我已经将日期的过滤器更改为今天的日期,并且已经等了24小时,它仍然没有显示.
有人面对这个,知道如何解决?
解决方法
Campaign接收器和服务已移至Google Analytics SDK的v2和v4之间的其他程序包名称.这可能会导致问题.
在v2中,软件包是com.google.analytics.tracking.android:
com.google.analytics.tracking.android.CampaignTrackingReceiver com.google.analytics.tracking.android.CampaignTrackingService
在v4中,软件包是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