我正在尝试使用Google Analytics(分析)跟踪我的应用速度,但是在Google Analytics(分析)帐户中我看不到任何应用程序的速度.我已经跟踪了其他参数,如事件,崩溃和异常.对于这些参数,我可以看到我的Google分析帐户中生成的报告.以下是我用来发送事件时间的代码.
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"); }
以下是控制台中打印的消息.
GoogleAnalytics 2.0b4 -[GAIDispatcher
dispatchComplete:withStartTime:withRetryNumber:withResponse:withData:withError:]
(GAIDispatcher.m:415) DEBUG: Successfully dispatched hit /GAIHit/p479
(0 retries).
如果你有,请提供任何示例代码.
请帮助我提前致谢.
解决方法
我发现间隔必须是一个整数.它是期望毫秒,但NSTimeInterval是秒,所以它尝试发送它为“3.1234”,但如果将其转换为毫秒,它会发送它为3123,你应该看到结果.要转换我使用(GA V3)
[tracker send:[[GAIDictionaryBuilder createTimingWithCategory:category interval:@((int)(interval * 1000)) name:name label:label] build]]
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。