Streaming live at 10am (PST)

Google Tag Manager directly after body tag

Hi,

what is the best method to integrate the google tag manager. What about “just directly afte the body tag” Is there a problem with the autmatically generated DIV when pasting the code directly on top of a page?

What about “just directly afte the body tag” Is there a problem with the autmatically generated DIV …

  <div class="w-embed w-script">
<!-- 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=
  '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
  })(window,document,'script','dataLayer','GTM-XYZ');
</script>
<!-- End Google Tag Manager -->

Checking the code with Googles Tag Assistant says:

<script> tag must not be included in a <div>

best
kalli

Just drag a HTML embed widget into the page and paste the code inside it.