【发布时间】:2017-07-04 13:07:05
【问题描述】:
我是 iOS 下 Google Analytics(现在的 Firebase?)的一种新的编程活动。 现在我正在编写一些 Objective C 应用程序,我需要跟踪所述应用程序中的一些自定义事件(典型的按钮按下等......)
我已经在我的 XCode 8.2.1 下成功安装了所有需要的 pod、.plist 文件等,没问题。
我的疑惑现在来了:
我添加了一些随机建议,我发现阅读了很多页面,并将它们应用到我的代码中所需的位置,但显然我无法创建/发送自定义事件。
我目前的设置是这样的:
-在我的 App Delegate 中,我添加了以下代码行:
// Google Analytics
// Configure tracker from GoogleService-Info.plist.
//
NSError *configureError;
[[GGLContext sharedInstance] configureWithError:&configureError];
NSAssert(!configureError, @"Error configuring Google services: %@", configureError);
// Optional: configure GAI options.
GAI *gai = [GAI sharedInstance];
gai.trackUncaughtExceptions = YES; // report uncaught exceptions
gai.logger.logLevel = kGAILogLevelVerbose; // remove before app release
// THIS lines are just a test... They don't make a difference if I comment them.
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
[tracker set:[GAIFields customDimensionForIndex:1] value:@"TEST_DIMENSION_VALUE" ];
-在我的 ViewController 中,我添加了这些其他行:
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
[tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"ui_status"
action:@"init_scan_process"
label:@"hello"
value:@1] build]];
好的,当我按下触发该事件的按钮时,运行时会发生什么?显然什么都没有。 如果我在 Firebase/Analytics 面板中,则不会出现任何自定义事件。我得到通用的非显式发送的(“进入某个屏幕”,等等......)。
我已将调试详细模式添加到 XCode 中(用于在 Firebase/Analytics 面板 -> StreamView -> DebugView 中进行实时调试。 通过这种方式,我可以获得各种实时事件(以 1 分钟的时间片)......但不是我的自定义事件。
显然,XCode 将我的 json 数据从我的自定义事件发送并转发到 Google...但是我不知道在 Firebase/Analytics 面板上的哪里可以找到它们。
我没有线索,我可能忘记了任何明显的暗示吗? 我愿意接受过去处理过类似情况的高级用户提出的问题。
问候和感谢。
【问题讨论】:
-
你在
appDidLaunch中打电话给[FIRApp configure]吗? -
看起来您正在登录 Google Analytics 而不是 FireBase 分析。 Firebase 分析代码看起来不同。 firebase.google.com/docs/analytics/ios/events
-
我一直在关注(并希望使用)Google Analytics 教程,而不是 Firebase。我用过这个:developers.google.com/analytics/devguides/collection/ios/v3/… 在我最初的问题中每次提到“Firebase”都在那里,因为后来,当我进入我的关联 Google Analytics 帐户面板时,它只是在左上角显示“Firebase”屏幕。在我的教程中,没有出现任何 [FIRApp configure] 行,所以我没有使用它。
标签: ios objective-c xcode google-analytics