angularfire
angularfire copied to clipboard
Cannot set user id and user property at the same time
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.
This issue does not seem to follow the issue template. Make sure you provide all the required information.