ezhil
ezhil copied to clipboard
Google Analytics
Hey,
Great job with the theme. Thanks.
GA is not working properly for what it looks like to me. I've checked that currently they use a different tag than the one you are setting.
I haven't found how you do that magic to inject GA code, otherwise I would try to make a PR.
New code:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXX-XX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-XXXX-XX);
</script>
Old code:
<script type="application/javascript">
var doNotTrack = false;
if (!doNotTrack) {
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-XXXX-XX', 'auto');
ga('send', 'pageview');
}
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
I would suggest keeping the doNotTrack
condition, but update to the more recent code.
Thanks
Actually its an internal template built into Hugo - https://gohugo.io/templates/internal/ Either we have to create a issue in Hugo repo or ditch internal template and use our own.
Having the same issue trying to set up Google Analytics right now with my site using ezhil - what would you recommend?