Malki Mohamed
Malki Mohamed

Reputation: 1688

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 ?

Upvotes: 3

Views: 4813

Answers (1)

XTOTHEL
XTOTHEL

Reputation: 5208

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

Upvotes: 3

Related Questions