I'm using react-ga4. I wonder how i could send user properties using this library and set it up in the google analytics panel as I think that i'm doing something wrong.
This is how i initialize ReactGA4
ReactGA.initialize(
[
{
trackingId: id,
gaOptions: {
role: userRole,
}
},
]
)
any suggestion?
It depends what user properties that you want to send. You can send custom user properties that not reserved by Google.
For example, I want to send
account_verifiedwith boolean value andnamewith string value in user property. You can useReactGA.gtag(...args)in this library, and then you can use it directly or put it intoutils/analytics.jsand wrap it to export function with parameter, so you can use it whenever it needs.or
After that, you can check in your Google Analytics in DebugView directly to ensure your user properties works well.