Android 控制台中的 Firebase Analytics 自定义事件报告

Android Firebase Analytics Custom Events Reporting in Console

如果这是 post 这个问题的错误地方,请提前接受我的道歉,因为我不确定会是什么。

我想要完成的是记录一个自定义,甚至使用 Firebase 分析在 Firebase 控制台中生成与他们的 select_content 事件示例类似的报告。触发方式如下:

    FirebaseAnalytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
    Bundle bundle = new Bundle();
    bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "ID");
    bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "NAME");
    bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "image");
    mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);

更具体地说,FirebaseAnalytics.Param.CONTENT_TYPE 之后的字符串可以是任何值,并将在控制台中生成如下所示的报告:

我将自己的自定义事件创建为:

Bundle params2 = new Bundle();
params2.putString(FirebaseAnalytics.Param.VALUE, "Google Play Games Sign out Button");
mFirebaseAnalytics.logEvent("Main_Activity_Button_Pressed", params2);

下面显示的为此事件生成的报告似乎没有考虑我添加的值。

是否有可能完成我想做的事情,如果可以,正确的实现方法是什么?

更新:这似乎无法用于测试目的,因为我最近发现了这一点:

这解释了为什么我的自定义参数没有出现在控制台中。

我相信附加到自定义事件的任何参数都被视为自定义参数(即使您使用来自 FirebaseAnalytics.Param class) and therefore the values are not represented directly in your reports as per the docs here:

Custom parameters: Custom parameters are not represented directly in your Analytics reports, but they can be used as filters in audience definitions that can be applied to every report. Custom parameters are also included in data exported to BigQuery if your app is linked to a BigQuery project.

首先,感谢 AdamK 添加此内容:

Custom parameters: Custom parameters are not represented directly in your Analytics reports, but they can be used as filters in audience definitions that can be applied to every report. Custom parameters are also included in data exported to BigQuery if your app is linked to a BigQuery project.

但是,我发现的是:

这可以解释为什么我的自定义参数没有出现,因为我是唯一的测试人员。

您的数据可能不会显示,因为您已将字符串值分配给包中的 FirebaseAnalytics.Param.VALUE。

根据 Param.VALUE 上的 FirebaseAnalytics 文档:

A context-specific numeric value which is accumulated automatically for each event type. Value should be specified with putLong(String, long) or putDouble(String, double). This is a general purpose parameter that is useful for accumulating a key metric that pertains to an event.

要记录字符串,您可以考虑使用 Param.CONTENT_TYPE 或您自己的自定义参数。

自 2017 年 5 月起,Google Analytics for Firebase 现在支持自定义参数报告。请参阅此帮助中心文章了解更多信息 details