Android - 我在 firebase 控制台中看不到任何事件

Android - I can't see any events in firebase console

我正在将 Log Events 发送到 fireBase,如下所示:

FirebaseAnalytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
Bundle bundle = new Bundle();
bundle.putInt("vendor_id", 588);
mFirebaseAnalytics.logEvent("manage_price_products", bundle);

但是我在 console!

中看不到任何 Event

首先,您可以使用 FirebaseAnalytics.Param class 提供的参数,定义如下: FirebaseAnalytics.Param to pass into the bundle. Also note that, you can use the events provided by FirebaseAnalytics.Event class as defined here: FirebaseAnalytics.Event 传入 logEvent.

例如,您的代码看起来像,

irebaseAnalytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
Bundle bundle = new Bundle();
bundle.putInt(FirebaseAnalytics.Param.ITEM_ID, 588);
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.ADD_TO_WISHLIST, bundle);

关于自定义事件:

官方Google Support answer表示:

Google Analytics for Firebase allows you to specify 25 parameters with each logged event. You can then identify up to 50 total event parameters (40 numeric and 10 textual) for which you would like to see reporting by registering those parameters with their corresponding events. Once your custom parameters have been registered, Google Analytics for Firebase will display a corresponding card showing the data in each event detail report.

  1. 在您要添加自定义参数的事件所在的行中,单击更多 > 编辑参数报告 .

  2. 输入参数名称字段中,输入您要添加的参数的名称。

    如果找到匹配项,select 将其添加到列表中并单击 添加。 如果未找到匹配项,请单击 ADD,然后输入参数名称。

  3. Type 字段设置为 TextNumber。对于数值参数,设置 Measurement 字段的 Unit

  4. 单击保存,然后单击确认

然后您将能够看到列出的事件。

请注意,可能需要 最多 24 小时 才能在 Firebase 控制台上列出和更新您的数据。此外,Firebase 控制台遵循 PST 时区。

据此https://support.google.com/firebase/answer/7201382?hl=en&utm_id=ad, 事件不会立即发送,但您可以激活设备中的 DebugView,这样您就可以实时查看事件。为此,打开模拟器(或保持您的设备连接)并在终端中执行命令

运行
adb shell setprop debug.firebase.analytics.app <package_name>

然后转到您的 firebase 控制台 - 在 DebugView 中。你可以实时看到事件。禁用 DebugView 运行

adb shell setprop debug.firebase.analytics.app .none.

(这仅适用于 Android)