Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Provide Opt Out Option #488
It is possible to disable tracking via
See https://developers.google.com/analytics/devguides/collection/analyticsjs/user-opt-out#opt-out_of_tracking_for_your_site. For the old
This should work with the new
Could you either provide an option, which enters the above code above all other JS code inserted by this plugin or at least provide an option to insert some code in the backend, which will be inserted before all other code? The "invidiual code" field does not work in this case as the code is inserted too late.
This feature is shipping with our next release.
Please note, as the ga.js tracking version of MonsterInsights is deprecated, we are no longer adding new features to it.
Therefore, to use this and other features, you must switch to Analytics.js if you have not already. If you are a new user, or if you are an existing user who does not see a notice to switch to Analytics.js on the General tab of the MonsterInsights settings panel, you are using Analytics.js (universal tracking).
To reduce conflicts with other plugins as well as to follow our plugin standard JS, our prefixed version of the function for the optout is
An example optout link is as follows:
Thanks a lot for this feature!
I just implemented __gaTrackerOptout() on my site. However I'encountered that this function throws an exception when executed as an admin.
This is obvious, because I've excluded the admin role from being tracked by MI. Thus the function does not exist, when I'm logged in as admin. Nevertheless the exception could be caught somehow.