如何在谷歌分析仪表板上看到“用户计时”?

时间:2022-04-06 14:18:55

I'm using GA in my iOS app and everything is working fine for all trackers but now I added tracker for User Timing and I'm not able to see the information I'm sending.

我在我的iOS应用程序中使用GA,所有追踪器都运行良好,但是现在我添加了追踪器来跟踪用户的时间,我无法看到我发送的信息。

This is the code I'm using:

这是我使用的代码:

 NSTimeInterval timeInterval = [timeOfPause timeIntervalSinceDate:timeOfStart];
 NSNumber *timeUsed = [NSNumber numberWithDouble:timeInterval];

[tracker send:[[GAIDictionaryBuilder createTimingWithCategory:@"ui_action"
                                                      interval:timeUsed
                                                          name:@"time used"
                                                        label:nil] build]];

I can see logs and values and they are ok but I can't find these informations on GA site.

我可以看到日志和值,它们是可以的,但是我在GA站点上找不到这些信息。

1 个解决方案

#1


7  

I think your problem is that you initiate your NSNumber instance (timeUsed) with a decimal value. The GA V3 SDK seems to require it to be an integer value. Also, the createTimingWithCategory:interval:name:label: method expects the interval in milliseconds.

我认为您的问题是您初始化了NSNumber实例(timeUsed),它具有十进制值。GA V3 SDK似乎要求它是一个整数值。另外,createTimingWithCategory:interval:name:label:方法希望间隔以毫秒为单位。

Your code should work if you change the second row in your code to:

如果您将代码中的第二行更改为:

NSNumber *timeUsed = [NSNumber numberWithInt:(int)(timeInterval*1000)];

See this answer: https://*.com/a/21408160/1652146

看到这个答案:https://*.com/a/21408160/1652146

#1


7  

I think your problem is that you initiate your NSNumber instance (timeUsed) with a decimal value. The GA V3 SDK seems to require it to be an integer value. Also, the createTimingWithCategory:interval:name:label: method expects the interval in milliseconds.

我认为您的问题是您初始化了NSNumber实例(timeUsed),它具有十进制值。GA V3 SDK似乎要求它是一个整数值。另外,createTimingWithCategory:interval:name:label:方法希望间隔以毫秒为单位。

Your code should work if you change the second row in your code to:

如果您将代码中的第二行更改为:

NSNumber *timeUsed = [NSNumber numberWithInt:(int)(timeInterval*1000)];

See this answer: https://*.com/a/21408160/1652146

看到这个答案:https://*.com/a/21408160/1652146