简体   繁体   English

Firebase Analytics - 将用户与事件相关联

[英]Firebase Analytics - Associating User With Events

I'm trying to understand how to associate Firebase events with specific users across installs/devices.我试图了解如何跨安装/设备将 Firebase 事件与特定用户相关联。 My understanding is that this is accomplished by setting the userId.我的理解是,这是通过设置 userId 来实现的。 But Firebase seems to be counting events across devices/installs as coming from separate users despite the same user id being assigned.但 Firebase 似乎将跨设备/安装的事件计算为来自不同用户的事件,尽管分配了相同的用户 ID。

Specifically, I have an iOS project that configures Firebase upon launch and assigns a userId:具体来说,我有一个 iOS 项目,它在启动时配置 Firebase 并分配一个 userId:

FirebaseApp.configure()
Analytics.setUserID("user.1")

I then allow the user to log an event by tapping a button:然后我允许用户通过点击一个按钮来记录一个事件:

Analytics.logEvent("test_event", parameters: ["param1": "val1"])

Every time that I delete the app and reinstall, then trigger the event, Firebase is considering it a unique user.每次我删除应用程序并重新安装,然后触发事件时,Firebase 都会将其视为唯一用户。 The dashboard indicates that test_event was recorded by 4 different users, but the userId was assigned the same value every time the event was recorded.仪表板指示 test_event 由 4 个不同的用户记录,但每次记录事件时都会为 userId 分配相同的值。

So my question is- do I misunderstand what setting the userId property does?所以我的问题是 - 我是否误解了 userId 属性的设置? Am I missing a configuration setting here?我在这里缺少配置设置吗? What's the deal?这是怎么回事?

I spoke with Firebase support directly to figure this out.我直接与 Firebase 支持人员交谈以解决这个问题。 It turns out that the notion of a "user" in the Firebase console is not related to the userID property at all.事实证明,Firebase 控制台中“用户”的概念与 userID 属性完全无关。 It always considers new "sessions" (installs, reinstalls, etc) as new users.它始终将新的“会话”(安装、重新安装等)视为新用户。 The userID assigned via setUserID is still recorded with the events, but can only be used to group events under the same user via BigQuery.通过 setUserID 分配的 userID 仍然记录在事件中,但只能用于通过 BigQuery 将事件分组到同一用户下。

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

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