Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Non-standard implementation Google Analytics

I have Google Analytics code and Google Tage Manager code in the same page, when I use Google Tag Assisant extension to check my codes but it show that there is Google Analytics twice. This is how I put it in head of my html page:

Google Analytics:

<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxx"></script>
<script>  window.dataLayer = window.dataLayer || [];  function gtag(){dataLayer.push(arguments);}  gtag('js', new Date());  gtag('config', 'UA-xxxxxxx');</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=
      'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
      })(window,document,'script','dataLayer','GTM-xxxxxxx');</script>

This is what Google Tag Assistant:

enter image description here

How I can fix this ?

like image 517
Malki Mohamed Avatar asked Jan 31 '26 18:01

Malki Mohamed


1 Answers

If you have the GA tag in GTM, you do not need to have the GA script in the head.

like image 191
XTOTHEL Avatar answered Feb 03 '26 07:02

XTOTHEL