AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
2.7K members online now
2.7K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

2 tracking codes

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I noticed on our website we have 2 GA Tracking codes. Why would we have 2 tracking codes? Would it be safe to remove one and still get the same results through GA? There are slight differences, one is using " compared to  ', and one mentions "cookieDomain".  Thanks for any help and assistance you can provide on this. 

1st: <script type="text/javascript">
<!--//--><![CDATA[//><!--
(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-4655739-2", {"cookieDomain":"auto"});ga("send", "pageview");
//--><!]]>
</script>

2nd: <script>
(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-4655739-2', 'auto');ga('send', 'pageview');
</script>

1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by Zee2 (Google Employee)
October 2016

2 tracking codes

Participant ✭ ✭ ☆
# 3
Participant ✭ ✭ ☆

You should definitely remove one of those codes.
The line:
ga("create", "UA-4655739-2", {"cookieDomain":"auto"});
is the same as
ga("create", "UA-4655739-2","auto");
because term "auto" refers to cookieDomain.

 

After removing one of the code you will notice increase of bounce rate and decrease of average pageviews, because right now every pageview hit is sending twice.

View solution in original post

2 tracking codes

[ Edited ]
Participant ✭ ✭ ✭
# 2
Participant ✭ ✭ ✭

Hi Mike,

 

Seems like both snippets (scripts) have exactly the same UA tracking code. You should remove the first one and everything will be fine.

 

I guess you have a really low bounce rate because of this right now and Google Analytics double-count all the pageviews. After removing one of the scripts, you'll see more accurate numbers in Google Analytics. 

  

ga('create', 'UA-4655739-2', {'cookieDomain':'auto'});

 

is exactly the same as

 

ga('create', 'UA-4655739-2', 'auto');

 

Hope this helps. Let us know how it goes.

Taavi

Marked as Best Answer.
Solution
Accepted by Zee2 (Google Employee)
October 2016

2 tracking codes

Participant ✭ ✭ ☆
# 3
Participant ✭ ✭ ☆

You should definitely remove one of those codes.
The line:
ga("create", "UA-4655739-2", {"cookieDomain":"auto"});
is the same as
ga("create", "UA-4655739-2","auto");
because term "auto" refers to cookieDomain.

 

After removing one of the code you will notice increase of bounce rate and decrease of average pageviews, because right now every pageview hit is sending twice.