我终于尝试使用Google Analytics(分析)v4。 其实,这是我第一次使用GA,所以我不太熟悉事情的完成方式。
无论如何,我设法获得了MobilePlayground样本,它主要工作 - 除了自动屏幕测量功能
示例中的XML配置文件与文档中的配置文件相似,因此我不必编辑任何内容即可使该部分起作用。 但是我没有在GA控制台中看到这些屏幕视图。
<!-- Enable automatic Activity measurement --> <bool name="ga_autoActivityTracking">true</bool> <!-- The screen names that will appear in reports --> <screenName name="com.google.android.gms.analytics.samples.mobileplayground.ScreenviewFragment"> AnalyticsSampleApp ScreenView </screenName> <screenName name="com.google.android.gms.analytics.samples.mobileplayground.EcommerceFragment"> AnalyticsSampleApp EcommerceView </screenName>(不要忘记,似乎没有一个名为“com.google.android.gms.analytics.samples.mobileplayground.ScreenviewFragment”的类)
我也在我自己的应用程序中尝试过,仍然没有显示任何屏幕视图。 即使那些GA日志级别设置为Verbose,当我访问为自动屏幕测量配置的那些活动时,在LogCat中也没有看到与GA有关的任何内容。 虽然当我访问我手动调用跟踪器发送屏幕视图的活动时,我看到大量GA调试输出。
所以我想我的问题是没有人在Google Analytics(分析)v4中使用此自动屏幕测量功能? 如果是这样,我还需要做些什么才能使“自动”测量正常工作?
I finally got around to trying out Google Analytics v4. Actually, it's my first time using GA at all, so I'm not quite as familiar with the way things are done.
In any case, I managed to get the MobilePlayground sample to build and it mostly works - except for the Automatic Screen Measurement feature
The XML config file in the sample is just like in the docs, so I shouldn't have to edit anything to get that part to work. But I don't see those screen views in the GA console.
<!-- Enable automatic Activity measurement --> <bool name="ga_autoActivityTracking">true</bool> <!-- The screen names that will appear in reports --> <screenName name="com.google.android.gms.analytics.samples.mobileplayground.ScreenviewFragment"> AnalyticsSampleApp ScreenView </screenName> <screenName name="com.google.android.gms.analytics.samples.mobileplayground.EcommerceFragment"> AnalyticsSampleApp EcommerceView </screenName>(Nevermind the fact that there doesn't seem to be a class called "com.google.android.gms.analytics.samples.mobileplayground.ScreenviewFragment")
I also tried it out on my own app and still no screen views are showing up. Even those GA log level is set to Verbose, I don't see anything in LogCat relating to GA when I visit those activities that I configured for automatic screen measurement. Though I see plenty of GA debug output when I visit an activity for which I'm manually calling the Tracker to send screen views.
So I guess my question is does anyone have this Automatic Screen Measurement feature working in Google Analytics v4? And if so, what else do I need to do to get "automatic" measurement to work?
最满意答案
那么,在SO上搜索一下,我在这里找到了一个解决方法
听起来好像GA中存在一个错误。 但是在GoogleAnalytics类上调用enableAutoActivityReports似乎会处理它。 一旦我在应用程序类中完成了这些工作,自动屏幕视图就会显示出来,并且屏幕名称已按照我的跟踪器XML中的配置正确映射。
请注意,enableAutoActivityReports表示它仅适用于API 14(ICS)及更高版本。 不知道姜饼应该做什么。
Well, a little more searching on SO and I found a workaround here
It sounds like there's a bug in GA. But making a call to enableAutoActivityReports on GoogleAnalytics class seems to take care of it. Once I did that in my application class, the automatic screen views showed up, and the screen names were correctly mapped as configured in my tracker XML.
Note that enableAutoActivityReports says it's only for API 14 (ICS) and above. Not sure what Gingerbread is supposed to do.
更多推荐
发布评论