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

Unable to set event-scoped custom dimension that applies to all sessions and events

Open benfixit opened this issue 3 years ago • 5 comments

There is a similar issue reported here. However, the suggested solution only addresses user-scoped custom dimensions.

Also, the documentation for ReactGA.event(options) suggests that dimension and metric can be passed in but this is not correct as the expected parameter is of type UaEventOptions.

    export type UaEventOptions = {
        action: string;
        category: string;
        label?: string;
        value?: number;
        nonInteraction?: boolean;
        transport?: ('beacon' | 'xhr' | 'image');
    };

benfixit avatar Jun 22 '22 06:06 benfixit

We're also running into this issue. The current types do not allow dimensions and metrics to be passed into .event.

The types over here do support those parameters. Can they be included in this package's types?

https://github.com/react-ga/react-ga/blob/master/types/index.d.ts#L40

cabaret avatar Jun 24 '22 13:06 cabaret

Yes same here, will there be a solution to support the parameters? @codler This package is currently the only one for GA4 and according to npm it has over 50k weekly downloads :)

BearCooder avatar Aug 03 '22 13:08 BearCooder

any one here know if it is possible to use this package to send user properties?

marioGMIT avatar Aug 23 '22 16:08 marioGMIT

Having the same issue, if anyone finds an alternative that would be great

jkliptonia avatar Aug 23 '22 17:08 jkliptonia

I'm running into the same issue with custom dimensions. It appears to send the dimension if they are named 'dimension1', 'dimension2', etc. I suppose this would make sense for migrating from reactGA as this was the required naming convention in UA.

For the moment, I am by passing the dimensions right to the gtag instance.

ReactGA.gtag('event', eventCategory, {...customDimensions });

where customDimensions is something like {myDimension: 'some val', myOtherDimension: 'some other val'}

blainegarrett avatar Nov 17 '22 23:11 blainegarrett