Set user properties
Closed this issue · 2 comments
It is important for some projects have the possibility to set user properties.
Zaraz send user properties prefixed with ep but user property in the URL needs to be prefixed with up instead of ep.
Exemple: https://www.google-analytics.com/g/collect?[...]&up.user_subscription_type=premium
Hi, thank you for your report. I'm going to investigate this shortly.
I've just checked the code, as well as tried to replicate this issue on a test zone.
When adding user properties, please make sure to manually specify the up.
prefix to the data you send. This component will then automatically remove the ep.
prefix and use the up.
prefix instead.
You can find the related part of this components code here: https://github.com/managed-components/google-analytics-4/blob/main/src/requestBuilder.ts#L145
Here's an example when using Zaraz in the Cloudflare Dashboard:
As far as I understand it, these user prefixes can have any custom name, so it's difficult for us to choose automatically. If you have any suggestions on how to detect that and use-cases that require an automatic detection, please let us know and we might look further into it.
For now, it seems to me like a won't fix though. Please feel free to correct me :)
Hope this helps