0
Hello, I’m having an error in the Google generated Analytics script. Which is exactly this way:
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXX-X"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-XXXXXXX-X');
</script>
In the browser console appears the following:
Uncaught Syntaxerror: Unexpected token ; (index):12
That line 12 is exactly that:
window.dataLayer = window.dataLayer || [];
I can not understand the reason for this error, since I am copying what Google provided me, pasted at the beginning of the tag <head>
as specified by Google.
Take a good look, because I’m thinking that the mistake is not in this line, because there is no mistake in it.
– Sam
I also think that’s it, only this script is the first one to hit the head, like there’s nothing before it might be screwing up.
– Julio Cesar