2
votes

My only confusion is:

Full code before Adding google tag manager as below ()

  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-65833292-1', 'auto');
  ga('send', 'pageview');

Now, for google tag manager code to be added, do I need to add the google tag manager script in addition of the above code or should I remove the tracking code of analytics and add ONLY GTM snippet?

1

1 Answers

2
votes

Ideally, you will need to remove all GA (on-page) tracking code including the standard snippet so that you only have the GTM snippet. Everything will be taken care of from within GTM (pageviews, events, other hits). Although leaving the GA code on the page does not cause any errors, it will skew your data.