Firebase 和 Google 跟踪代码管理器:<FIRAnalytics/WARNING> 尝试记录 nil 事件
Posted
技术标签:
【中文标题】Firebase 和 Google 跟踪代码管理器:<FIRAnalytics/WARNING> 尝试记录 nil 事件【英文标题】:Firebase and Google Tag Manager : <FIRAnalytics/WARNING> Attempted to log nil event 【发布时间】:2017-07-03 23:33:52 【问题描述】:我在 cocoapods 上集成了 Firebase 和 GTM:
pod 'Firebase/Core'
pod 'GoogleTagManager', '~> 5.0'
所用版本的 Podfile.lock :
Firebase/核心 (3.12.0): FirebaseAnalytics (= 3.6.0) FirebaseCore (= 3.4.7) FirebaseAnalytics (3.6.0): FirebaseCore (~> 3.4) FirebaseInstanceID (~> 1.0) GoogleInterchangeUtilities (~> 1.2) GoogleSymbolUtilities (~> 1.1) GoogleToolboxForMac/NSData+zlib (~> 2.1) FirebaseCore (3.4.7): GoogleInterchangeUtilities (~> 1.2) GoogleSymbolUtilities (~> 1.1) GoogleToolboxForMac/NSData+zlib (~> 2.1) FirebaseInstanceID (1.0.8) GoogleAnalytics (3.17.0) GoogleInterchangeUtilities (1.2.2): GoogleSymbolUtilities (~> 1.1) GoogleSymbolUtilities (1.1.2) GoogleTagManager (5.0.8): FirebaseAnalytics (~> 3.0) GoogleAnalytics (~> 3.0) GoogleUtilities (~> 1.3.0) GoogleToolboxForMac/Defines (2.1.1) GoogleToolboxForMac/NSData+zlib (2.1.1): GoogleToolboxForMac/Defines (= 2.1.1) 谷歌实用程序 (1.3.2): GoogleSymbolUtilities (~> 1.1)
并按照文档中的步骤进行集成,但我收到以下警告:
GoogleTagManager info: Processing logged event: (null) with parameters: (null)
<FIRAnalytics/WARNING> Attempted to log nil event
从应用开始的完整日志:
Firebase automatic screen reporting is disabled. UIViewController transitions will not be automatically logged. To report screen transitions manually, call +[FIRAnalytics setScreenName:setScreenClass:
setupFirebase (670139-com.apple.main-thread)
<FIRInstanceID/WARNING> FIRInstanceID AppDelegate proxy enabled, will swizzle app delegate remote notification handlers. To disable add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO
<FIRAnalytics/INFO> Firebase Analytics v.3600000 started
<FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see ...)
<FIRAnalytics/INFO> Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist
<FIRAnalytics/INFO> Firebase Analytics enabled
GoogleTagManager info: Loading container: GTM-XXXXXXX
GoogleTagManager info: Attempting to load saved version of container GTM-XXXXXXX
GoogleTagManager info: Processing logged event: gtm.load with parameters: (null)
GoogleTagManager warning: Invalid Event name: gtm.load (Must not start with an underscore and must consist of letters, digits and/or underscores)
Should commit UiContext but SignalR is disconnected: nil (670139-com.apple.main-thread)
: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x125947998) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x125769880). One of the two will be used. Which one is undefined.
<FIRAnalytics/WARNING> setScreenName:screenClass: must be called after a view controller has appeared
GoogleTagManager info: Processing logged event: openScreen with parameters:
System group container for systemgroup.com.apple.configurationprofiles path is /Users/xxx/Library/Developer/CoreSimulator/Devices/5F44EFE3-0BDF-402A-A01B-8F6EABB31B22/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
Reading from private effective user settings.
SignalR :: Connected (670139-com.apple.main-thread)
GoogleTagManager info: Processing logged event: _s with parameters:
<FIRAnalytics/ERROR> Event name is reserved. Ignoring event: session_start
GoogleTagManager info: Processing logged event: (null) with parameters: (null)
<FIRAnalytics/WARNING> Attempted to log nil event
<FIRAnalytics/WARNING> Attempted to log nil event
GoogleTagManager info: Processing logged event: (null) with parameters: (null)
<FIRAnalytics/WARNING> Attempted to log nil event
GoogleTagManager info: Processing logged event: (null) with parameters: (null)
<FIRAnalytics/WARNING> Attempted to log nil event
编辑
我从配置文件中删除了“.json”扩展名。日志说:
GoogleTagManager warning: No default container found. Container needs to be added to a container folder and added to the target.
Configuration was not found in database. The configuration will be fetched from the network when necessary
Firebase Analytics is ready to receive events
Firebase Analytics enabled
Fetching configuration from the server
Downloading data. Host: https://app-measurement.com/config/app/1:...
Successful fetched configuration from the server. Got network response. Code, size: 200, 106
Successfully parsed a configuration. Version: 1484056.........
Measurement data sent to network
Successful upload. Got network response. Code, size: 204, 0
有什么想法吗???
但是错误消失了???
任何想法
编辑 2
将 Pod 升级到最新版本:
Firebase/核心 (3.14.0): FirebaseAnalytics (= 3.7.0) FirebaseCore (= 3.5.1) FirebaseAnalytics (3.7.0): FirebaseCore (~> 3.5) FirebaseInstanceID (~> 1.0) GoogleToolboxForMac/NSData+zlib (~> 2.1) FirebaseCore (3.5.1): GoogleToolboxForMac/NSData+zlib (~> 2.1) FirebaseInstanceID (1.0.9) GoogleAnalytics (3.17.0) GoogleSymbolUtilities (1.1.2) GoogleTagManager (5.0.8): FirebaseAnalytics (~> 3.0) GoogleAnalytics (~> 3.0) GoogleUtilities (~> 1.3.0) GoogleToolboxForMac/Defines (2.1.1) GoogleToolboxForMac/NSData+zlib (2.1.1): GoogleToolboxForMac/Defines (= 2.1.1) 谷歌实用程序 (1.3.2): GoogleSymbolUtilities (~> 1.1)
但仍然收到保留事件错误:
2017-03-02 11:00:17.854 <Error> [Firebase/Analytics][I-ACS013006] Event name is reserved. Ignoring event: user_engagement
2017-03-02 11:00:17.854 GoogleTagManager info: Processing logged event: (null) with parameters: (null)
有趣的是 Firebase 忽略了以下事件:
由 Firebase 或 GTM 保留 我没有发送:(
【问题讨论】:
检查你的代码,看看你是否有 FIRAnalytics.logEvent(withName: '', parameters: nil) 或类似的 logEvent 接受 nil ???但要确保我检查 nil 并发送具有 1 个临时值的字典。没有变化:( 我认为它不接受零,只是想仔细检查一下。可以肯定的是,您的日志名称不是以下划线开头的,对吧? 打开类 func logEvent(withName name: String, parameters: [String : NSObject]?) 我的意思是您正在记录的事件的名称。我可以在您发布的日志中看到您正在尝试记录一个名为 _s 的事件,但正如 Firebase 文档所说:不得以下划线开头,必须由字母、数字和/或下划线组成 【参考方案1】:在我的情况下,问题是因为以错误的方式包含文件。只要确保正确包含容器文件夹即可。提示:项目导航器中的文件夹图标颜色应为蓝色。
【讨论】:
【参考方案2】:当您删除 json 扩展时,Google 跟踪代码管理器无法找到任何容器,并且不会下载容器。您可以从发布屏幕或容器的版本页面下载容器。
自动记录的事件“_s”被忽略,因为 Firebase Analytics 已经记录了该事件,并且 Google 跟踪代码管理器不会修改自动事件。您可以使用“_s”事件触发其他代码,或触发自定义 Firebase Analytics 代码。
要跟踪有关空事件名称的其他警告,我会在您的代码中搜索任何使用未初始化变量的 logEvent 调用。
【讨论】:
我知道移除 json 扩展的副作用。我故意这样做是为了测试结果。没有它它会更好地工作(没有我抱怨的错误日志)。我没有使用“_s”事件,我不知道它是什么,所以这绝对是 Firebase 或 GTM 内部问题。我搜索了代码库,没有空事件调用,所有事件都调用一个函数,它检查字符串长度。我的猜测是 Firebase 或 GTM 在保留事件名称之后给出了这个错误。以上是关于Firebase 和 Google 跟踪代码管理器:<FIRAnalytics/WARNING> 尝试记录 nil 事件的主要内容,如果未能解决你的问题,请参考以下文章
Google 跟踪代码管理器命中在 Google Analytics(分析)中不可见