简体   繁体   English

未将 Analytics 事件记录到 Firebase

[英]Analytics events not being logged to Firebase

I'm attempting to log simple analytic events to Firebase but nothing is ever showing up online.我正在尝试将简单的分析事件记录到 Firebase,但没有任何内容在线显示。

Here is how I'm logging the event:这是我记录事件的方式:

    FIRAnalytics.logEventWithName("spot_view", parameters: [
        "spot_name": spotName,
        "is_private": isPrivate
        ])

I have the run time arguments on to see the Firebase output and I get this:我有运行时参数来查看 Firebase 输出,我得到了这个:

<FIRAnalytics/DEBUG> Event logged. Event name, event params: spot_view, {
        "_o" = app;
        "is_private" = 1;
        "spot_name" = TestLogSpotView;
    }

So the event is being triggered.所以事件正在被触发。 I also get this showing that data is actually being uploaded:我也得到这个表明数据实际上正在上传:

2016-06-09 12:12:13.567 [60279:] <FIRAnalytics/DEBUG> Measurement data sent to network. Timestamp (ms), data: 1465488733550, <ACPMeasurementBatch 0x7de7bb60>: {
        bundles {
          protocol_version: 1
          events {
            params {
              name: "_c"
              int_value: 1
            }
            params {
              name: "_o"
              string_value: "auto"
            }
            name: "_f"
            timestamp_millis: 1465488710347
          }
          events {
            params {
              name: "_et"
              int_value: 1
            }
            params {
              name: "_o"
              string_value: "auto"
            }
            name: "_e"
            timestamp_millis: 1465488710347
          }
          events {
            params {
              name: "_o"
              string_value: "app"
            }
            params {
              name: "is_private"
              int_value: 1
            }
            params {
              name: "spot_name"
              string_value: "TestLogSpotView"
            }
            name: "spot_view"
            timestamp_millis: 1465488710411
          }
          events {
            params {
              name: "content_type"
              string_value: "cont"
            }
            params {
              name: "_o"
              string_value: "app"
            }
            params {
              name: "item_id"
              string_value: "1"
            }
            name: "select_content"
            timestamp_millis: 1465488710411
          }
          user_attributes {
            set_timestamp_millis: 1465488710347
            name: "_fot"
            int_value: 1465491600000
          }
          upload_timestamp_millis: 1465488733550
          start_timestamp_millis: 1465488710347
          end_timestamp_millis: 1465488710411
          platform: "ios"
          os_version: "9.3"
          device_model: "x86_64"
          user_default_language: "en-us"
          time_zone_offset_minutes: -240
          app_store: "manual_install"
          app_id: “——“
          app_version: "0.0.0"
          gmp_version: 3200
          uploading_gmp_version: 3200
          resettable_device_id: “—“——
          limited_ad_tracking: false
          app_instance_id: “———“
          bundle_sequential_index: 1
          gmp_app_id: “———“
          firebase_instance_id: “———“
          app_version_major: 106
        }
    }
2016-06-09 12:12:13.568[60279:] <FIRAnalytics/DEBUG> Uploading data. Host: https://app-measurement.com/a
2016-06-09 12:12:13.595[60279:] <FIRAnalytics/DEBUG> Received SSL challenge for host. Host: https://app-measurement.com/a
2016-06-09 12:12:13.731[60279:] <FIRAnalytics/DEBUG> Successful upload. Got network response. Code, size: 204, 0

I ran this same code a couple of days ago and still nothing has showed up in Firebase.几天前我运行了相同的代码,但 Firebase 中仍然没有显示任何内容。

I've also tried logging an event copied straight from Firebase which is this:我还尝试记录直接从 Firebase 复制的事件,如下所示:

    FIRAnalytics.logEventWithName(kFIREventSelectContent, parameters: [
        kFIRParameterContentType:"cont",
        kFIRParameterItemID:"1"
        ])

Which you can see in the log console output posted above.您可以在上面发布的日志控制台输出中看到。

The only other thing I could think would be wrong is in the GoogleService-Info.plist.我认为唯一错误的另一件事是在 GoogleService-Info.plist 中。 There is an entry for IS_ANALYTICS_ENABLED which is set to no. IS_ANALYTICS_ENABLED有一个条目设置为 no。 I just flipped it to YES and going to try again although I don't believe this to be the fix.我只是将其翻转为YES ,然后再试一次,尽管我认为这不是解决方法。 I think this entry only applies to Google Analytics.我认为此条目仅适用于 Google Analytics。

在此处输入图片说明


Which also, other data such as device type and user sessions IS being logged.其中还记录了其他数据,例如设备类型和用户会话。 So it just logging events that doesn't work.所以它只是记录不起作用的事件。

This may be one reason for custom events这可能是自定义事件的原因之一

 Event name must contain only letters, numbers, or underscores. 

My events were not logged as I was using a space in my event name.我的事件未记录,因为我在事件名称中使用了空格。

One quick thing to check -- make sure your date range encompasses the date on which this event was logged.需要快速检查的一件事 - 确保您的日期范围包含记录此事件的日期。 For example, if the event was logged today, you should change the date range to explicitly include Today.例如,如果事件是今天记录的,您应该更改日期范围以明确包括今天。 Ranges like "Last 30 Days" or "Last 7 Days" do not include Today. “过去 30 天”或“过去 7 天”等范围不包括今天。

If you don't see your reports update, you should contact support in order to get to the bottom of it more quickly.如果您没有看到您的报告更新,您应该联系支持人员以便更快地找到它的底部。

Just for those unfortunate subjects (like myself) that get to this question while not seeing ANY Firebase analytics output anymore (no events in the Firebase console online and no local Firebase debug messages).仅适用于那些遇到此问题而不再看到任何 Firebase 分析输出的不幸主题(如我自己)(在线 Firebase 控制台中没有事件,也没有本地 Firebase 调试消息)。 For whatever reason, by accident, I removed the code that used to call无论出于何种原因,我偶然删除了用于调用的代码

FIRApp.configure()

No matter what other flags or such I set, Analytics events that always worked fine before wouldn't show up.无论我设置了什么其他标志或类似的标志,之前一直运行良好的 Analytics 事件都不会出现。 And the logging code still worked without any complaints -- just not doing anything apparently.并且日志代码仍然可以正常工作,没有任何抱怨——只是显然没有做任何事情。 The configure() call was the last thing that I came to check. configure()调用是我检查的最后一件事。

This might be a late answer but I double checked other solution and still had similar issue.这可能是一个迟到的答案,但我仔细检查了其他解决方案,但仍然有类似的问题。

I fixed the issue by looking at the parameters sent with the event.我通过查看随事件发送的参数解决了这个问题。 Make sure all parameters are sent have a value.确保发送的所有参数都有一个值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM