首页 > 解决方案 > 在 Firebase 中查看事件详情

问题描述

我正在向 Fabric 和 Firebase 发送应用使用分析事件。与事件一起,我还发送了另一个值(示例事件类型是 font_selection,我传递的值是用户选择的字体 - 这是一个告诉我使用了哪种字体的数字)。我正在使用 Fabric 事件,当我选择 font_selection 事件时,我可以看到或多或少地使用了哪些字体(我可以看到每种不同字体的数字)。

由于 Fabric 功能正在转移到 Firebase,我开始检查 Firebase 中的 Analytics(分析)部分。不幸的是,我在 Firebase > Analytics > Events 中找不到上述信息。我可以看到该事件 font_selection,但是当我单击它时,我没有获得以前在 Fabric 中获得的其他信息。是否有我遗漏的东西或这些附加信息已从 Firebase 中删除?

标签: firebaseeventsfirebase-analytics

解决方案


这对我来说仍然是一个问题。这是我将事件发送到 Firebase 的方式:

protected void Report(string id, Severity severity, string message = null, Exception exception = null)
    {
        try
        {
            var processedId = id ?? severity.ToString().ToLowerInvariant();
            var values = new Dictionary<string, string>();

            values.Add("severity", severity.ToString().ToLowerInvariant());

            if (!string.IsNullOrWhiteSpace(message))
            {
                values.Add("message", message);
            }

            if (exception != null)
            {
                values.Add("exception", exception.Message);
                values.Add("trace", exception.StackTrace);
            }

            SendEvent(values, processedId);
        }
        catch
        {
            // do nothing.
        }
    }

protected override void SendEvent(Dictionary<string, string> eventData, string id)
    {
        var firebaseAnalytics = FirebaseAnalytics.GetInstance(Android.App.Application.Context);
        var bundle = new Android.OS.Bundle();

        foreach(var pair in eventData)
        {
            bundle.PutString(pair.Key, pair.Value);
        }

        firebaseAnalytics.LogEvent(id, bundle);
    }

在运行时,我成功调用了它,我可以看到这些事件在 Firebase 控制台中弹出:

在此处输入图像描述

但是如何显示我捆绑的其余属性呢?这是控制台在事件中向我显示的内容:

在此处输入图像描述

我觉得我一定是用错了什么的。没有 UI 可以向我显示一个简单的按时间顺序排序的表,其中包含事件以及它们附带的属性。坦率地说,我不明白这个工具对我有什么好处。


推荐阅读