codler / react-ga4

React Google Analytics 4
https://www.npmjs.com/package/react-ga4
266 stars 34 forks source link

Documentation update for React GA modalview or add functionality that encapsulate it #41

Open devchuksemeka opened 1 year ago

devchuksemeka commented 1 year ago

React GA has a modalview, and according to documentation, it's basically just an abstraction on pageview here - https://github.com/react-ga/react-ga#reactgamodalviewmodalname. Is it possible to update the documentation for react-ga4 on this?

I had to go digging into the ReactGA.modalview() function here https://github.com/react-ga/react-ga/blob/087837dc03d482549ded7669ac559df0c7cc5498/src/core.js#L237 and it's just creating path = /modal/{passedModalName}.

A document to either let the user know that this should be done if they are migrating a usage of modalview or create a function that abstracte this for the user. I don't mind raising an PR for either that makes sense

Using the abstraction function, adding a new hitType="modalview" maybe

ReactGA4_gaCommandSend() reference https://github.com/codler/react-ga4/blob/d0b14c26a7dd5fdbe98e3dd4ef0e6653d0a19ba3/src/ga4.js#LL324C10-L324C10`