I've added the package to the gatsby site and added the google analytics ID as mentioned in the docs. I'm also setting a cookie with a value true/false based on user action. I would like to give an option to the user so that he can opt-out from future tracking.
I found the following in the docs section. <a href="javascript:gaOptout();">Deactivate Google Analytics</a> which can be used for opting out. I've used this and it doesn't seem working as expected. It throws an error saying that gaOptOut is undefined, which means that global analytics isn't set properly.
I might have missed something. How can I test if ga is being set properly?
I've added the package to the gatsby site and added the google analytics ID as mentioned in the docs. I'm also setting a cookie with a value true/false based on user action. I would like to give an option to the user so that he can opt-out from future tracking.
I found the following in the docs section.
<a href="javascript:gaOptout();">Deactivate Google Analytics</a>
which can be used for opting out. I've used this and it doesn't seem working as expected. It throws an error saying thatgaOptOut
is undefined, which means that global analytics isn't set properly.I might have missed something. How can I test if ga is being set properly?