This Post, which helped me to create a custom event with custom params as well in react. I can able to see those parameters in GA realtime and events reports as well. But I had a question create a custom event with custom param will be the same when using Custom dimensions and Custom metrices in GA4. if not, then what do I integrate Custom dimensions and Custom metrices in my react application(using react-ga4)
Have Integration GA4 with React and sending custom events and custom params as well. my current code:
const trackGoogleAnalyticsEvent = (category: string, event_name: string, data?: object, label?: string) => {
const userData = {
user_name: loginDetail?.name,
role: loginDetail?.idTokenClaims?.role,
supplier_consumer_mapped: userAccessMapping?.map(({ SupplierName }) => SupplierName)?.join(', '),
...data,
}
const event_params = {
category,
label,
...userData,
}
// Send GA4 Event
console.log({ event_name, event_params })
ReactGA4.event(event_name, event_params)
}