react-ga4
react-ga4 copied to clipboard
Not seeing user-id event parameter in GA4 dashboard
Hi there!
I'm trying to use ReactGA.send to pass user_id to React GA4.
useEffect(() => {
ReactGA.send({ hitType: 'pageview', page: location.pathname, user_id: user?.id ?? '' })
// Track the pageview with react-ga
}, [location, user])
In my local environment, I do see an event call being made with the user id as uid.
In Google Analytics 4 dashboard, I tried viewing the page_view events, but I don't see user_id or anything of the sort as one of the event parameters. Is there something that I may be missing on the GA dashboard side to be able to see the event parameter show up?
Any help / insights would be greatly appreciated!
I found that if you separately set the user id via ReactGA.set you can track it across all events:
ReactGA.set({ user_id: user?.id });