我已经看到了一些关于 Firebase 分析的自定义事件的问题和答案,但我只是想问你一个直截了当的问题,这样你就可以给我一个直截了当的答案 :)
所以,这是我的记录方法:
@Override
public void logFeatureSelectedEvent(String categoryName, String actionName, String labelName) {
Bundle bundle = new Bundle();
bundle.putString(EventTrackingKeys.EventTypes.CATEGORY, categoryName);
bundle.putString(EventTrackingKeys.EventTypes.ACTION, actionName);
bundle.putString(EventTrackingKeys.EventTypes.LABEL, labelName);
mFirebaseAnalytics.logEvent(EventTrackingKeys.EventAnalyticTypes.FEATURE_SELECTED_EVENT, bundle);
}
使用自定义事件/键名称:
String CATEGORY = "category";
String ACTION = "action";
String LABEL = "label";
String FEATURE_SELECTED_EVENT = "feature_selected_event";
因此,在我的 firebase 控制台中,我只获得事件名称“feature_selected_event”,没有自定义参数名称。我已经看到一些答案,我应该调用 setUserProperty() 方法并在 Firebase Analytics 的“用户属性”选项卡中注册该用户属性。这是实现该方法的正确方法吗?:
@Override
public void logFeatureSelectedEvent(String categoryName, String actionName, long value) {
Bundle bundle = new Bundle();
bundle.putString(EventTrackingKeys.EventTypes.CATEGORY, categoryName);
bundle.putString(EventTrackingKeys.EventTypes.ACTION, actionName);
bundle.putLong(EventTrackingKeys.EventTypes.VALUE, value);
mFirebaseAnalytics.setUserProperty(EventTrackingKeys.EventTypes.CATEGORY, categoryName);
mFirebaseAnalytics.setUserProperty(EventTrackingKeys.EventTypes.ACTION, actionName);
mFirebaseAnalytics.setUserProperty(EventTrackingKeys.EventTypes.VALUE, value);
mFirebaseAnalytics.logEvent(EventTrackingKeys.EventAnalyticTypes.FEATURE_SELECTED_EVENT, bundle);
}