谷歌Analytics(分析)Android的V4 - 自动屏幕尺寸不工作?工作、屏幕尺寸、Analytics、谷歌

2023-09-07 15:37:22 作者:雅痞

我终于可以尝试谷歌Analytics(分析)V4。其实,这是利用GA我所有的第一次,所以我不是很熟悉的事情完成的方式。

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.

在任何情况下,我设法让MobilePlayground样品来构建和它主要工程 - 除了Automatic屏幕测量功能

In any case, I managed to get the MobilePlayground sample to build and it mostly works - except for the Automatic Screen Measurement feature

样品中的XML配置文件就像是在文档,所以我不应该有任何编辑拿到的那部分工作。但我不认为在GA控制台屏幕上的那些意见。

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>

(没关系的事实,似乎没有被一类称为com.google.android.gms.analytics.samples.mobileplayground.ScreenviewFragment)

(Nevermind the fact that there doesn't seem to be a class called "com.google.android.gms.analytics.samples.mobileplayground.ScreenviewFragment")

我也尝试过了我自己的应用程序,仍然没有屏幕视图显示出来。即使是那些GA日志级别设置为详细,我没有看到在LogCat中与GA当我访问,我配置了自动屏幕测量这些活动的任何东西。虽然我看到很多GA调试输出,当我访问一个活动,我敢手动调用跟踪发送屏幕视图。

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.

所以我想我的问题是有没有人有这种自动屏幕测量功能在谷歌Analytics(分析)v4的工作吗?如果是这样,还有什么我需要做的就是自动测量工作?

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,我发现一个解决办法这里

Well, a little more searching on SO and I found a workaround here

这听起来像有一个在GA的错误。但是在呼叫enableAutoActivityReports在Google分析类似乎照顾它。一旦我做了,在我的应用程序类,自动屏幕视图显示了,在我的跟踪器XML配置的屏幕名称进行正确映射。

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.

注意enableAutoActivityReports说,这是仅适用于API 14(ICS)及以上。不知道什么是姜饼应该做的。

Note that enableAutoActivityReports says it's only for API 14 (ICS) and above. Not sure what Gingerbread is supposed to do.