Hello, I'm having an error in the Google-generated script in Analytics. 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 the following appears:
Uncaught SyntaxError: Unexpected token; (index): 12
This line 12 is exactly this:
window.dataLayer = window.dataLayer || [];
I can not understand the reason for this error, since I am copying what Google provided me with, I pasted it at the beginning of the <head>
tag as specified by Google.