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

Initialize as soon as user accepts consent #4

Closed
romixch opened this issue Nov 20, 2019 · 2 comments
Closed

Initialize as soon as user accepts consent #4

romixch opened this issue Nov 20, 2019 · 2 comments

Comments

@romixch
Copy link

romixch commented Nov 20, 2019

Thanks for your nice gatsby plugin! It is very convenient. But there is something that would make it even nicer:

Google Analytics is only activated when the user visits the page the second time. Until then ReactGA reports following warning in the console:
ReactGA.initialize must be called first or GoogleAnalytics should be loaded manually
Should the method ReactGA.initialize somehow be incorporated into onRouteUpdate?

@andrezimpel
Copy link
Owner

@romixch I'm actually doing a reload of the page as soon as the user klicks the accept cookies button on the banner. What you could to is to initialize GA with the click on the button.

ReactGA.initialize(options.googleAnalytics.trackingId);

Maybe the plugin could also expose a function for this. Something like reinitialize. What do you think?

@phmasek
Copy link

phmasek commented Sep 13, 2020

@andrezimpel I implemented it the way you suggested using ReactGA. But I think it would be much more elegant if the plugin would expose the function itself as you propose. Great job with the plugin btw 👌🏻

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

3 participants