Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is "Error: GA4 is being initialized" expected behaviour? #20

Open
gurnoora21 opened this issue Jun 15, 2021 · 4 comments
Open

is "Error: GA4 is being initialized" expected behaviour? #20

gurnoora21 opened this issue Jun 15, 2021 · 4 comments

Comments

@gurnoora21
Copy link

Screen Shot 2021-06-15 at 9 32 13 AM

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?

@bert0RM
Copy link

bert0RM commented Jul 25, 2021

I was able to get it to work fine.
Are you initializing the class two times?

@RM-Eric
Copy link

RM-Eric commented Feb 11, 2022

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?

@unrealmanu
Copy link
Owner

you can keep the result of the initialization promise in a variable, without having to initialize again

I hope I was helpful, a greeting

@RM-Eric
Copy link

RM-Eric commented Feb 11, 2022

Thanks, that worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants