GoogleAnalytics HitBuilders.TimingBuilder [英] GoogleAnalytics HitBuilders.TimingBuilder
问题描述
我使用遗传算法的一个Android应用程序。
I'm using GA for an Android App.
我想使用的用户定时来报告多少时间已经过去了我的code一些动作,所以我basiclly做的是这样的:
I'm trying to use user timings to report how much time has passed for some actions in my code, so what I basiclly do is this:
目前在code我得到一些点 System.currentTimeMillis的()
,在另一点,我再次做到这一点,substract后者从前者获得如何太多的时间已经过去了。然后,我就报GA是这样的:
At some point in the code I get System.currentTimeMillis()
, at another point I do it again and substract 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(timimngVariable)
.setLabel(timingLabel)
.setCustomDimension(1,1)
.setCustomMetric(1, timingValue).build());
当我看应用速度一节一切都看起来很好。好像我希望报告的逻辑avarage时间(秒)。
When I look at the "App Speed" section everything looks fine. It seems to report a logical avarage time in seconds like I expect.
现在的问题是,我想用几个维度(二级维度是不够的),所以我创造了这一切计时的metrices以及这样我就可以看到他们在自定义报告。当我看到这份报告,当时我看到有 9点43分39秒
键,我不知道有什么格式在这里。难道秒:hundreth秒:第二十届?我怎么能看到这些metrices的avarage时间?我不知道,如果我看到的只是时间的总量或某事elese?
The problem is that I want to use several dimensions (the secondary dimension is not enough) so I created all these timings as metrices 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:hundreth of a second? And How can I see the avarage time of these metrices? I'm not sure if what I see is only the total amount of time or something elese?
推荐答案
A 值类型时间
(对于事件和自定义指标)应该传递一个整数(没有逗号或小数)重新presenting秒。因此,例如,10秒应该是10,并在5分钟应为300,等等。注意的报告,它将被格式化为 HH:MM:SS
。
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
.
这篇关于GoogleAnalytics HitBuilders.TimingBuilder的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!