Recent Topics

1 Apr 22, 2019 02:30    

Hi guys,

I'm getting an error of invalid XHTML for the google analytics tag inserted in "collection/settings/advanced/Custom meta tag/css section (before </head>)".
Shouldn't it be accepted just as it is? I tried to loose the settings as suggested but didn't work too.

Validation errors:
Tag <body> may not contain raw character data
Parser error: Space required near <script async src="https://www.googletagmanager.com/gtag/js?id=UA-----------"></script> <script>
Invalid Custom meta tag/css section. You can loosen this restriction in the Group settings.

Google Analytics Tag Validation errors
Google Analytics Tag Validation errors

2 Apr 23, 2019 02:41

This is solved, I managed to fix the google's original code so it becomes valid for the XHTML validation.
Just use a template like this (don't forget to replace 111222333-1 with your tag). Tested and receiving hits ok B)

<script src="https://www.googletagmanager.com/gtag/js?id=UA-111222333-1">
  // Global site tag (gtag.js) - Google Analytics
</script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'UA-111222333-1');
</script>


Form is loading...