[英]How to use Google's User Timing feature in iOS analytics SDK
[英]Where to find User TIming reports for Google Analytics for Mobile (iOS)
我正在使用sendTimingWithCategory:withTimeInterval:withName:withLabel
發送用戶計時數據,但似乎無法在Google Analytics(分析)報告工具中找到這些數據。
在我的應用中,我嘗試捕獲不同類型的用戶計時,這是一些代碼片段:
// duration1 & duration2 are instances of NSTimeInterval
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
[tracker sendTimingWithCategory:@"DurationOnApp" withValue:duration1 withName:nil withLabel:nil];
[tracker sendTimingWithCategory:@"DurationOnSectionA" withValue:duration2 withName:nil withLabel:nil];
這讓我很震驚:是因為我應該給name
賦一個值,而不是將其保留為nil。
工作正常: [tracker sendTimingWithCategory:@"DurationOnApp" withValue:duration1 withName:@"DurationOnApp" withLabel:nil];
。
顯然,類別和名稱都是必需的。 用戶計時現在顯示在“參與度”->“應用速度”中
這可行。 Google在文檔中有錯誤。 SDK的V3。 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.