【发布时间】:2015-12-21 12:37:39
【问题描述】:
我正在尝试在我的 iOS 应用中实现 GA。在我的 Xcode 控制台中,我看到来自 GA 系统的一堆消息,这些消息似乎都显示成功跟踪了我的屏幕视图,但我从未在我的 Google Analytics 帐户/属性的实时概览中看到任何内容。
这是我经历的步骤:
1) 通过 pod 安装 GoogleAnalytics
2) 通过https://developers.google.com/mobile/add为我的应用配置了一个谷歌服务项目并添加了谷歌分析
3) 这为我生成了一个 GoogleService-Info.plist,我将它添加到我的项目中。
4) 我在 AppDelete 中配置了 GAI:
GAI *gai = [GAI sharedInstance];
gai.trackUncaughtExceptions = YES;
gai.logger.logLevel = kGAILogLevelVerbose;
gai.dispatchInterval = 5;
5) 接下来我配置了我的视图控制器来跟踪屏幕视图:
- (NSString*) gaiScreenName {
return NSStringFromClass([self class]);
}
- (void) gaiLogScreenView {
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
[tracker set:kGAIScreenName value:[self gaiScreenName]];
[tracker send:[[GAIDictionaryBuilder createScreenView] build]];
}
- (void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self gaiLogScreenView];
}
在我的控制台中,看起来一切正常:
2015-09-23 18:59:23.595 MyAppName[370:206928] VERBOSE: GoogleAnalytics 3.13 -[GAIBatchingDispatcher persist:] (GAIBatchingDispatcher.m:517): Saved hit: {
parameters = {
"&_crc" = 0;
"&_s" = 15;
"&_u" = ".oK9L";
"&_v" = "mi3.1.3";
"&a" = 23452345;
"&aid" = "com.inadaydevelopment.myappid";
"&an" = MyAppName;
"&av" = "1.1";
"&cd" = ViewAnimalViewController;
"&cid" = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx";
"&dm" = "iPhone7,2";
"&ds" = app;
"&sr" = 640x1136;
"&t" = screenview;
"&tid" = "UA-XXXXXXX-2";
"&ul" = en;
"&v" = 1;
"&z" = 1234123412341234;
gaiVersion = "3.13";
};
timestamp = "2015-09-24 01:59:23 +0000";
}
2015-09-23 18:59:25.199 MyAppName[370:206928] VERBOSE: GoogleAnalytics 3.13 -[GAIRequestBuilder requestPostUrl:payload:compression:] (GAIRequestBuilder.m:167): building URLRequest for https://ssl.google-analytics.com/batch
2015-09-23 18:59:25.200 MyAppName[370:206928] VERBOSE: GoogleAnalytics 3.13 -[GAIBatchingDispatcher dispatchWithCompletionHandler:] (GAIBatchingDispatcher.m:632): Sending hit(s) POST: https://ssl.google-analytics.com/batch
2015-09-23 18:59:25.492 MyAppName[370:206887] INFO: GoogleAnalytics 3.13 -[GAIBatchingDispatcher didSendHits:response:data:error:] (GAIBatchingDispatcher.m:226): Hit(s) dispatched: HTTP status 200
但是,我从未在我的 Google Analytics(分析)报告中看到任何数据。我已确认我正在查看正确的帐户/属性/视图。
我错过了什么或做错了什么?
【问题讨论】:
标签: ios objective-c google-analytics