简体   繁体   English

Firebase Analytics 按用户 ID 过滤

[英]Firebase Analytics Filter By User ID

The Firebase Android SDK for analytics provides a method named setUserId(String id) , now i enabled firebase logging and every time i called the method setUserId(1234) i see this in the logs Setting user property (FE): _id, 1234 .用于分析的 Firebase Android SDK 提供了一个名为setUserId(String id) ,现在我启用了 Firebase 日志记录,每次我调用方法setUserId(1234)我都会在日志中看到这个Setting user property (FE): _id, 1234

My question is how come the Firebase dashboard does not let us filter by this property, there is no property not for userId and not _id, i even tried to add _id as a property in the dashboard but Firebase does not allow property names to start with an underscore.我的问题是 Firebase 仪表板为什么不让我们按此属性过滤,没有不是 userId 和 _id 的属性,我什至尝试在仪表板中添加 _id 作为属性,但 Firebase 不允许属性名称以下划线。

Do i really have to stop calling that method and just do setUserProperty("userId", 1234) or am i missing something...我真的必须停止调用该方法而只执行setUserProperty("userId", 1234)还是我错过了什么......

I have spent a few hours on this and found the answer i was looking for more or less, hopefully this might save someone else some time.我在这上面花了几个小时,找到了我或多或少正在寻找的答案,希望这可以为其他人节省一些时间。

The only way to filter by Firebase's User Id property is by creating an audience, there you will be able to pick the user id property that is supplied from the setUserId(String id) method.通过 Firebase 的 User Id 属性进行过滤的唯一方法是创建一个受众,您可以在那里选择从setUserId(String id)方法提供的用户 id 属性。

It is a downer though because you won't see any events for the user/user's you want from before the audience was created.不过,这令人沮丧,因为在创建观众之前,您不会看到您想要的用户/用户的任何事件。

I was scratching my head with this issue.我正在为这个问题挠头。 Initially, I felt so dumb when I could not find how to use user id for filtering in Firebase analytics dashboard that I am setting with official API setUserId() .最初,当我在使用官方 API setUserId()设置的 Firebase 分析仪表板中找不到如何使用用户 ID 进行过滤时,我感到非常愚蠢。 When I try to look for answer, I realized that I am not the only one.当我试图寻找答案时,我意识到我不是唯一一个。 Finally, this is how I was able to filter events based on user id.最后,这就是我能够根据用户 ID 过滤事件的方式。


In Android Code, I set user id using setUserId() method.在 Android 代码中,我使用setUserId()方法设置用户 ID。 When I read bigQuery has this property as user_id , I thought to give it a try by adding a new user property in Firebase Dashboard with the hope that it will fetch the reported id.当我读到 bigQuery 有这个属性为user_id ,我想通过在 Firebase 仪表板中添加一个新的用户属性来尝试一下,希望它能获取报告的 id。 新用户属性

And... that worked...Now I can filter new events based on user id.而且...有效...现在我可以根据用户 ID 过滤新事件 在此处输入图片说明

In audience you have to select contains, exactly match or regular expression for a field.在受众中,您必须为字段选择包含、完全匹配或正则表达式。

So to filter for a user you have to add all your users to the audience, which looks cumbersome.因此,要过滤用户,您必须将所有用户添加到受众中,这看起来很麻烦。

Isn't using setUserProperty is better?使用 setUserProperty 不是更好吗? Have you faced any problems with using it ?您在使用过程中遇到过什么问题吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM