[英]iOS Google analytics not tracking App speed
我正在嘗試使用Google Analytics(分析)跟蹤我的應用速度,但在網站上看不到任何低於應用速度的信息。 但是我可以看到其他參數,例如事件,崩潰和異常。以下是我用來發送事件計時的代碼。
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)調試:已成功調度匹配/ GAIHit / p479(0次重試)。 請幫我。
這可行。 Google在文檔中有錯誤。 NSTimeInterval是double,他們的SDK需要整數。 他們網站上的示例具有誤導性。
- (void)onLoad:(NSTimeInterval *)loadTime {
NSNumber* timeInterval = [NSNumber numberWithInt:((int) (loadTime * 1000))];
[tracker sendTimingWithVariableCategory:@"resources"
withTimeInterval:timeInterval
withName:@"high scores"
withLabel:nil];
... // The rest of your onLoad: code.
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.