ga-4-react
ga-4-react copied to clipboard
is "Error: GA4 is being initialized" expected behaviour?

Hey,
Is "GA4 is being initialized" an expected error within console on any page using this package. Looking at the js code for the package, it seems like the error is thrown while the initialization code is run?
I was able to get it to work fine. Are you initializing the class two times?
I get this as well, using the snippet of code given in the docs
ga4react.initialize().then((ga4) => {
ga4.pageview('path')
ga4.gtag('event','pageview','path') // or your custom gtag event
},(err) => {
console.error(err)
})
Is there a way to call ga4.pageview()
a second time for subsequent page views (ie route changes w react router) without initializing again?
you can keep the result of the initialization promise in a variable, without having to initialize again
I hope I was helpful, a greeting
Thanks, that worked.