feat: change script to use the new Google Analytics 4
This commit is contained in:
committed by
José Guilherme Vanz
parent
9e6f6a15f0
commit
5cb9d6db8a
@@ -1,11 +1,11 @@
|
|||||||
{% if GOOGLE_ANALYTICS %}
|
{% if GOOGLE_ANALYTICS %}
|
||||||
<script type="text/javascript">
|
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
<script async src="https://www.googletagmanager.com/gtag/js?id={{ GOOGLE_ANALYTICS }}"></script>
|
||||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
<script>
|
||||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
window.dataLayer = window.dataLayer || [];
|
||||||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
function gtag(){dataLayer.push(arguments);}
|
||||||
|
gtag('js', new Date());
|
||||||
|
|
||||||
ga('create', '{{ GOOGLE_ANALYTICS }}', '{{ GA_COOKIE_DOMAIN if GA_COOKIE_DOMAIN else 'auto' }}');
|
gtag('config', '{{ GOOGLE_ANALYTICS }}');
|
||||||
ga('send', 'pageview');
|
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user