Trying to insert GTM code for MODX revolution into head chunk before closing and I getting white screen in browser and in error log I am getting this. it doesn't like first line of code in GTM:
[2023-09-04 14:50:55] (ERROR @ /var/www/u444/data/www/my-domain.com/core/components/pdotools/model/pdotools/pdotools.class.php : 999) Unexpected tag 'w' in head line 37, near '{w[' <- there in a7079a48faef018b6bba5ad8e296596e line 1, near '{include 'head'' <- there
here is GTM code:
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-FFFFFFF');</script>
<!-- End Google Tag Manager -->
I tried to install GTM snippet to head chunk
Solution is easy. Add space or break line symbol after each '{' symbol in GTM code. This solve the problem for me.