Learn business growth with Google Analytics 4 Forums Google Analytics 4 Integrating Google Tag(gtag) and Google Tag Manager Reply To: Integrating Google Tag(gtag) and Google Tag Manager

  • Kelsey

    13 June 2023 at 2:57 pm

    Certainly! Essentially, the two systems – Google Analytics 4 (GA4) and Google Tag Manager (GTM) – are somewhat independent and each has its own functionality. The ‘gtag.js’ and the ‘gtm.js’ files are two different libraries and they serve distinctive purposes, with the former being for GA4 and the latter being for GTM. When you use GTM, it essentially replaces the direct implementation of gtag.js for GA4 in your code. This means you no longer need to directly include the GA4 tracking in your code, as this will be managed via GTM. When you configure GTM, you’ll create an account and container, and obtain a specific container ID (represented as ‘GTM-XXXX’). This GMT-XXXX goes into the GTM script instead of the gtag script. Then, within the GTM interface, you can set up GA4 tags with their own tracking IDs, and add different events on your site. By doing this, you can manage all your tracking implementations, including GA4, via the GTM interface, centralizing your tag management and making it more manageable and tidier.