本文介绍了iOS:Google Analytics 用户计时报告未在我的 Google Analytics 帐户中更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Google Analytics(分析)跟踪我的应用速度,但在我的 Google Analytics(分析)帐户中的应用速度下看不到任何内容.我已经跟踪了其他参数,如事件、崩溃和异常.对于这些参数,我可以查看在我的 google 分析帐户中生成的报告.以下是我用来发送事件计时的代码.

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.

GoogleAnalytics 2.0b4 -[GAIDispatcherdispatchComplete:withStartTime:withRetryNumber:withResponse:withData:withError:](GAIDispatcher.m:415) 调试:成功调度命中/GAIHit/p479(0 次重试).

如果你有任何示例代码,请提供给我.请帮助我.提前致谢.

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 帐户中更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 19:42