如何在Firebase Analytics中设置自定义用户操作?

时间:2022-05-01 15:51:16

I am a first timer at Firebase Analytics and I need some help with event logging.

我是Firebase Analytics的新手,我需要一些事件日志记录方面的帮助。

I'd like to organize my user actions like "Screen X, event Y".

我想组织我的用户操作,比如“Screen X, event Y”。

What I achieved so far is this:

到目前为止,我所取得的成就是:

Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, screenName);
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, actionName);
firebase.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);        

and I invoke this method every time I want to log something.

每次我想要记录一些东西时我都会调用这个方法。

In the Analytics console, this translates to a chart with all the screen names organized by Content_type, like this:

在分析控制台中,这将转换为包含按Content_type组织的所有屏幕名称的图表,如下所示:

如何在Firebase Analytics中设置自定义用户操作?

but when I click on one of the items (the tutorial screen "TUT" for example), nothing is organized by actionName. It's all bundled in (not_set) like this:

但是当我点击其中一个条目(例如教程屏幕“TUT”)时,actionName没有组织任何东西。它都像这样(not_set)捆绑在一起:

如何在Firebase Analytics中设置自定义用户操作?

What am I doing wrong?

我做错了什么?

Is there a better way to handle this type of stuff?

有更好的办法处理这类事情吗?

1 个解决方案

#1


1  

Solved!

解决了!

It seems like you need to set an ITEM_ID as well, in addition to CONTENT_TYPE and ITEM_NAME.

除了CONTENT_TYPE和ITEM_NAME之外,似乎还需要设置ITEM_ID。

Hence I got it working by just adding the ITEM_ID parameter like this:

因此,我通过添加ITEM_ID参数来实现它:

Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, screenName);
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, actionName);
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, actionName);
firebase.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);  

I don't know if it is the right way to handle this kind of event logging but it works for now.

我不知道这是正确的方式来处理这种事件日志记录,但现在工作。

Better solutions are welcome!!

更好的解决方案是受欢迎的!

#1


1  

Solved!

解决了!

It seems like you need to set an ITEM_ID as well, in addition to CONTENT_TYPE and ITEM_NAME.

除了CONTENT_TYPE和ITEM_NAME之外,似乎还需要设置ITEM_ID。

Hence I got it working by just adding the ITEM_ID parameter like this:

因此,我通过添加ITEM_ID参数来实现它:

Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, screenName);
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, actionName);
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, actionName);
firebase.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);  

I don't know if it is the right way to handle this kind of event logging but it works for now.

我不知道这是正确的方式来处理这种事件日志记录,但现在工作。

Better solutions are welcome!!

更好的解决方案是受欢迎的!