Closed mei-lu closed 1 day ago
I just tried to replicate this, but am unable to. I end up with this:
<script>window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments)};
gtag('js', new Date());
gtag('config', 'WOOF', {'send_page_view': true,'anonymize_ip': false,'link_attribution': false,'allow_display_features': false});
</script>
<script>dataLayer = [];
(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','BARK');
</script>
...with no extra unclosed <script>
tags. Are you sure they might not be coming from somewhere else in your code?
@khalwat I could only replicate it locally when I set my environment to production ("live"). Global search in our code for anything GA related comes up blank. Sorry I forgot to mention that in the original description.
Right, that's what I did as well testing things... I set the SEOmatic environment to "live" so that the tracking scripts would render.
Are you sure there aren't any stray <script>
tags anywhere in your templates?
I ask just because in a bare bones install, turning on both of those scripts did not result in what you reported initially.
@khalwat Thanks for looking into that. I think our script template got messed up. Adjusting that fixes it, appreciate you looking into this!
Describe the bug
When Google Tag Manager and Google gtag.js are both enabled, an extra script opening tag gets injected. When Google Tag Manager is disabled however, the issue goes away.
To reproduce
Steps to reproduce the behaviour:
<body>
and an extra<script>
tag is inserted that remains unclosed.Expected behaviour
There should be no portion of the script injected into the
<body>
Versions