我正在尝试将简单的分析事件记录到 Firebase,但没有任何东西出现在网上。
这是我记录事件的方式:
FIRAnalytics.logEventWithName("spot_view", parameters: [
"spot_name": spotName,
"is_private": isPrivate
])
我有运行时参数来查看 Firebase 输出,我得到了这个:
<FIRAnalytics/DEBUG> Event logged. Event name, event params: spot_view, {
"_o" = app;
"is_private" = 1;
"spot_name" = TestLogSpotView;
}
所以事件被触发了。我也得到这表明数据实际上正在上传:
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
几天前我运行了同样的代码,但在 Firebase 中仍然没有出现任何内容。
我还尝试记录直接从 Firebase 复制的事件,即:
FIRAnalytics.logEventWithName(kFIREventSelectContent, parameters: [
kFIRParameterContentType:"cont",
kFIRParameterItemID:"1"
])
您可以在上面发布的日志控制台输出中看到。
我认为唯一错误的另一件事是在 GoogleService-Info.plist 中。有一个条目IS_ANALYTICS_ENABLED
设置为 no。我只是把它翻过来,YES
然后再试一次,尽管我不相信这是解决办法。我认为这个条目只适用于谷歌分析。
此外,还记录了其他数据,例如设备类型和用户会话。所以它只是记录不起作用的事件。