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

[Request] Support options.titleCase

Open fehbari opened this issue 2 years ago • 4 comments

The original react-ga support a titleCase parameter when initializing. This doesn't seem to be present here. All my events are sent with a capitalized first letter.

e.g. this_event ends up as This_event in Google Analytics.

fehbari avatar May 17 '23 17:05 fehbari

I'm having the same issue. Is there a fix for this as of now?

vabadio avatar May 18 '23 16:05 vabadio

@vabadio The way I'm working around it is by using the alternative call with event name + parameters object.

ReactGA.event('my_event_action', {
    event_category: 'my_category',
    event_label: 'my_label',
    value: 'my_value',
    non_interaction: true,
    ...otherParams, // optional
});

Everything is sent in the desired case that way.

With this call you can also send custom dimensions alongside the event (the ...otherParams part).

fehbari avatar May 18 '23 18:05 fehbari

@fehbari thank you so much!

vabadio avatar May 26 '23 19:05 vabadio

Created a PR to support this either when creating ga4 instance or when calling the event() method

7assenTlili avatar Jan 11 '24 22:01 7assenTlili