Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google tag manager adding async scripts in to head of page

I've recently moved some of our scripts into Google tag manager via Custom HTML with a document with write enabled. However, most, if not all scripts are being added to the head of the page as a async script.

For example:

<head>
<script async type="text/javascript" src="https://www.externalSite.co.uk/visitor.js?mhRand=1513770036670"></script>
</head>

Why are these being added to the head of the site, instead they should be loaded at the bottom of the page?

Am I missing a setting somewhere within GTM?

like image 498
marjfh67 Avatar asked Feb 01 '26 04:02

marjfh67


1 Answers

  1. All Tag Manager Tags are loaded Async so no need to specify it.
  2. You can not use the labels on the HTML Tag.
  3. Since you can not control that i ll be load on the header you might want to do it as soon as possible. In order to do this just use a pageview trigger and firing priority. If any resourses depended on this script here is a nice post.
like image 200
Marco Avatar answered Feb 03 '26 06:02

Marco



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!