GoogleAnalytics HitBuilders.TimingBuilder

五迷三道 提交于 2019-12-31 07:05:09

问题


I'm using GA for an Android App.

I'm trying to use user timings to report how much time has passed for some actions in my code, so what I basically do is this:

At some point in the code I get System.currentTimeMillis(), at another point I do it again and subtract the latter from the former to get how much time has passed. I then report it to GA like this:

long time1 = System.currentTimeMillis();
...
long time2 = System.currentTimeMillis();
long timingValue = time2 - time1;
tracker.send(new HitBuilders.TimingBuilder()
            .setCategory(timingCategory)
            .setValue(timingValue)
            .setVariable(timingVariable)
            .setLabel(timingLabel)
            .setCustomDimension(1,1)
            .setCustomMetric(1, timingValue).build());

When I look at the "App Speed" section everything looks fine. It seems to report a logical average time in seconds like I expect.

The problem is that I want to use several dimensions (the secondary dimension is not enough) so I created all these timings as metrics as well so I can see them in a custom report. When I look at the report, the time I see there is 09:43:39 and I'm not sure what's the format here. Is it seconds:tenth of a second:hundredth of a second? And How can I see the average time of these metrics? I'm not sure if what I see is only the total amount of time or something else?


回答1:


A Value of type time (for both events and custom metrics) should be passed as a whole number (no commas or decimals) representing seconds. So for example, 10 seconds should be 10, and 5 minutes should be 300, etc. Note that in the reports, it will be formatted as hh:mm:ss.



来源:https://stackoverflow.com/questions/30324977/googleanalytics-hitbuilders-timingbuilder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!