Skip to content
Snippets Groups Projects
Unverified Commit 1974815b authored by Tom Robinson's avatar Tom Robinson Committed by GitHub
Browse files

Merge pull request #9707 from flamber/fix9464

Stop loading GA script if Anonymous Tracking is opt-out
parents e17348b8 f02651a9
No related branches found
No related tags found
No related merge requests found
......@@ -80,19 +80,17 @@
</script>
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
// if we are not doing tracking then go ahead and disable GA now so we never even track the initial pageview
// if Anonymous Tracking is opt-out, then do not load script
const tracking = window.MetabaseBootstrap.anon_tracking_enabled;
const ga_code = window.MetabaseBootstrap.ga_code;
if (!tracking) {
window['ga-disable-'+ga_code] = true;
}
if (tracking) {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', ga_code, 'auto');
const ga_code = window.MetabaseBootstrap.ga_code;
ga('create', ga_code, 'auto');
}
</script>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment