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

ReactGA.ga(...args) not returning window.ga

Open jcshott opened this issue 1 year ago • 0 comments

When using react-ga - we would set up the cross-domain tracking with the linker option in GA:

ex:

ReactGA.ga("require", "linker")
ReactGA.ga("linker:autoLink", ["source.com"])

When we upgraded to this library - we started getting warnings in the console:

Command doesn't exist: require
Command doesn't exist: linker:autoLink

It looks like this invocation is getting caught up here: https://github.com/codler/react-ga4/blob/master/src/ga4.js#L356-L367

whereas in the old react-ga library - this method would return window.ga https://github.com/react-ga/react-ga/blob/087837dc03d482549ded7669ac559df0c7cc5498/src/core.js#L30

What is the correct way to migrate this function call to react-ga4?

jcshott avatar May 20 '24 16:05 jcshott