我按照 Google 指南中提供的说明将 Google Analytics SDK 添加到我的项目中。但是,当我尝试跟踪一些事件时,这是调试输出:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[…]
// Google Analytics
[GAI sharedInstance].trackUncaughtExceptions = YES;
[GAI sharedInstance].dispatchInterval = 20;
[[[GAI sharedInstance] logger] setLogLevel:(PADEV ? kGAILogLevelVerbose : kGAILogLevelError)];
[[GAI sharedInstance] trackerWithTrackingId:@"UA-XXXXXXXX-Y"]; // This is obviously replaced with my tracking ID
return YES;
}
和
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
[tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"article"
action:@"read"
label:@""
value:self.post[@"id"]] build]];
日志:
2014-11-12 01:02:25.144 PonzApp[5236:112706] INFO: GoogleAnalytics 3.10 -[GAIBatchingDispatcher didSendHits:response:data:error:] (GAIBatchingDispatcher.m:208): Hit(s) dispatched: HTTP status -1
2014-11-12 01:02:25.146 PonzApp[5236:112781] INFO: GoogleAnalytics 3.10 -[GAIBatchingDispatcher deleteHits:] (GAIBatchingDispatcher.m:509): hit(s) Successfully deleted
2014-11-12 01:02:25.147 PonzApp[5236:112781] INFO: GoogleAnalytics 3.10 -[GAIBatchingDispatcher didSendHits:] (GAIBatchingDispatcher.m:219): 1 hit(s) sent
它说命中已发送,但 HTTP 状态很奇怪-1
,如果我在仪表板上查看“实时”部分,什么也没有出现。
有什么问题?