Google Opt Out

Google provides a great analytics tool. But you should consider the privacy of your visitors. This extension allows your users to opt out from Google's tracking.
How to use
Installation
Using this extension is very easy. Just install it from Pagekit's marketplace.
Configuration
After enabling the extension, you can enter your property ID (e.g. UA-123456-1
); if spqr/googleoptout
should take care of your scripts, just check the box labeled Manage Tracking Code. If you do so, please remove the Google Tracking script from your site, if you inserted the code before.
If you don't enable this, please make sure to remove the line gtag('config', 'UA-123456-1');
from your script.
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-123456-1">
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-123456-1');
</script>
Expected result:
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-123456-1">
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
</script>
You then need to call gtag('config', 'UA-123456-1');
later (make sure the extension has been executed).
Warning: If you are including the script by yourself, you need to make sure, that the Google-scripts are loaded after the Opt Out has been running. It's highly recommended to use the built-in tag management.
- CMS
- Pagekit
How to fork a theme
Written by Abdulhalim on
spqr/toc updated
Written by Roman on
spqr/toc updated
Written by Nick Sbarounis on