react-ga4 icon indicating copy to clipboard operation
react-ga4 copied to clipboard

Not seeing user-id event parameter in GA4 dashboard

Open ChenCodes opened this issue 1 year ago • 1 comments

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. Screen Shot 2024-08-16 at 2 23 42 PM

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?

Screen Shot 2024-08-16 at 2 25 14 PM

Any help / insights would be greatly appreciated!

ChenCodes avatar Aug 16 '24 21:08 ChenCodes

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 });

sbatson5 avatar Nov 25 '24 18:11 sbatson5