angular / angular/angularfire

Cannot set user id and user property at the same time

未关闭
#3,193 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
7.8k
派生
2.2k
平均合并
22 小时 28 分钟
30 天内合并 PR
6

描述

### Version info

**Angular:** 12.2.0

**Firebase:** 9.6.6

**AngularFire:** 7.2.1

### Expected behavior

I need to set user id and a user property after a user has logged in. User property is product_amount, and the user belongs to different audiences based on the product_amount.

### Actual behavior

Every user is counted to belong to two audiences. After user has logged in, I set `this.analytics.setUserId(id);`, which causes product_amount to be zero. After user id is set, I set user properties with
```
this.analytics.setUserProperties(
{ product_amount: this.product_amount },
{ global: true }
);
```
which logs the real product amount.

It is not possible to set user id and user properties at the same time. That means initial user property is always the wrong one.

贡献指南

打开贡献指南

调研方向

首先,使用 Angular 12.2.0、Firebase 9.6.6 和 AngularFire 7.2.1,通过 setUserId 和 setUserProperties 设置 product_amount 属性来复现该问题。检查 AngularFire 的 analytics 入口点和 Firebase Analytics 的行为,以确定为什么设置 ID 会重置该属性;当两个值都保持正确且受众分配准确时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
firebase, typescript
领域
analytics
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
30/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。