Skip to content

Commit

Permalink
Change Google analytics load script to tag, instead of traditional an…
Browse files Browse the repository at this point in the history
…alytics.js
  • Loading branch information
gaikaz committed Aug 26, 2024
1 parent 4bcb417 commit 9cbef1a
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions extensions/odoo_theme/layout_templates/google_analytics.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ google_analytics_key }}"></script>
<script>
(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','//www.google-analytics.com/analytics.js','ga');

ga('create', '{{ google_analytics_key }}', 'auto');
ga('set', 'anonymizeIp', true);
ga('send','pageview');
</script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ google_analytics_key }}');
</script>

0 comments on commit 9cbef1a

Please sign in to comment.