Hi,
We are trying to put the following code before the </head> in the template settings:
<!-- Anti-flicker snippet (recommended) -->
<style>.async-hide { opacity: 0 !important} </style>
<script>(function(a,s,y,n,c,h,i,d,e){s.className+=' '+y;h.start=1*new Date;
h.end=i=function(){s.className=s.className.replace(RegExp(' ?'+y),'')};
(a[n]=a[n]||[]).hide=h;setTimeout(function(){i();h.end=null},c);h.timeout=c;
})(window,document.documentElement,'async-hide','dataLayer',4000,
{ GTM-XXXXXXX:true});</script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<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', { 'optimize_id': 'GTM-XXXXXXX'});
</script>
However, when we put this in the template settings before the </head> the google tag manager says for the Optimize part:
Page-hiding snippet not in HEAD
When we look in the source code we can see that it's not in the head.
Any thoughts on how we can put this in the <head>?
Kind regards