Search code examples
google-tag-manager

Difference between Google Tag Manager Integrations


I have built several web sites with Google Analaytics and Google Tag Manager integrations. As time goes on its becoming unclear to me what is the difference between these integreations. Can someone provide any details on this?

I have one site that has the following in the head...

 <script async src="https://www.googletagmanager.com/gtag/js?id=<G-SOME-TAG-A>"></script>
 <script>
  window.dataLayer = window.dataLayer || [];
  function gtag() { dataLayer.push(arguments); }
  gtag('js', new Date());

  gtag('config', 'G-SOME-TAG-A');
 </script>


and then I have another site that has the following implementation


<!-- in the <head> //-->

<!-- 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-SOME-TAG-B');</script>
<!-- End Google Tag Manager -->

<!--below the body opening element -->

<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-SOME-TAG-B"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->


Why do we have this confusion coming from Google, if we are all using the same Google Tag Manager application.


Solution

  • The first part you paste is called Google Tag

    They just like merge it as Google Tag recently so it can use one tag to send data to multiple Google Marketing System application like GA4, Google Ads...

    Google Tag


    The second part you paste is called Google Tag Manager

    Quite a different tool that use to manage all marketing or 3rd party tags or pixels like Facebook Pixel or Twitter Pixel

    Google Tag Manager


    The relationship between them is that Google Tag Manager can act as a container to control Google Tag and other pixels.

    However, it's not incorrect to implement Google Tag's code directly on your website, although it's not the recommended approach.