问题描述
我试图使用Google Analytics(分析)来追踪我的应用速度,但在Google Analytics(分析)帐户中,我无法在应用速度下看到任何内容。我跟踪了其他参数,如事件,崩溃和异常。对于这些参数能够看到我的谷歌分析帐户中生成的报告。以下是我用来发送事件时间的代码。
I am trying to track my app speed using Google analytics but i could not see anything under app speed in my google analytics account. I have tracked the other parameters like events,crashes and exceptions. For those parameter am able to see the reports generated in my google analytic account. Following is the code what i am using to send event timing.
self.endDate=[NSDate date];
double timeDiff=[_startDate
timeIntervalSinceDate:_endDate];
NSLog(@"timeDiff----%f",timeDiff);
if([[[GAI sharedInstance]defaultTracker] sendTimingWithCategory:category
withValue:timeDiff
withName:@"LoadTime"
withLabel:category]) {
NSLog(@"Succesfully sent load time to GA");
}
以下是控制台中显示的信息。
Following is the message printed in the console.
如果您有任何代码,请提供示例代码。
请帮助我。提前致谢。
Provide me any sample code if u have.Please help me in that. Thanks in advance.
推荐答案
我发现间隔必须是一个整数。它期望毫秒,但NSTimeInterval是秒,因此它会尝试将其发送为3.1234,但如果将其转换为整个毫秒,则会将其发送为3123,并且您应该看到结果。 (GA V3)
I found that the interval had to be a whole number. It's expecting milliseconds but NSTimeInterval is seconds so it tries to send it as "3.1234" but if you convert it to whole milliseconds it will send it as 3123 and you should see results. To convert I used (GA V3)
[tracker send:[[GAIDictionaryBuilder createTimingWithCategory:category interval:@((int)(interval * 1000)) name:name label:label] build]]
这篇关于iOS:Google Analytics用户计时报告未在我的Google Analytics帐户中更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!