Analytics
2.3K members online now
2.3K 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

Why is the addition of a second Analytics Tracking Code affecting my stats?

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Please refer to a thread I have already started in this forum: 

 

https://productforums.google.com/forum/#!msg/webmasters/ELkYgXcwmd8/vnW1OU92GgAJ

 

For a little background info, this issue started because I received an alert in GA that I had "Redundant hostnames" - and that I wasn't receiving accurate tracking data from both www. and non www. versions of my site. 

 

Someone on another forum referenced that installing a second set of GA tracking code would resolve this issue; one for the www. version, and the second for the non www. version, and setting just one as the preferred domain. 

 

Indeed, this solution did resolve the "Redundant Hostnames" issue I was having - however, it has also affected the stats I am seeing (bounce rate / page per session etc.) are affected. 

 

Please either see the original thread, or take a look at this screenshot for specifics. 

 

Screen Shot 2016-02-23 at 12.59.36 PM.pngScreen Shot 2016-02-23 at 1.00.08 PM.pngScreen Shot 2016-02-23 at 12.59.56 PM.pngScreen Shot 2016-02-23 at 1.00.17 PM.png

 

So my questions are;
1. Why would adding a second set of tracking code affect these metrics at all? 
Note: The fact that the number of sessions etc. hasn't been affected tells me that the second set of code isn't simply reporting EVERYTHING twice (or by a given percentage) - it is ONLY affecting these three metrics. 
 
2. Should I consider the results MORE or LESS accurate with the second set of tracking installed?
1 Expert replyverified_user

Re: Why is the addition of a second Analytics Tracking Code affecting my stats?

Top Contributor
# 2
Top Contributor
Hi Sandy,

If you have two instances of the tracking code for the same property you are basically sending two pageviews instead of one in the same session. This messes up the metrics you mentioned making your results less accurate of course..
You need to remove the second instance of the tracking code, set the preferred version in webmaster tools and 301 redirect the non preferred version to the preferred version. This will resolve all of the issues.

Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

Re: Why is the addition of a second Analytics Tracking Code affecting my stats?

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
The 301 redirects were set up and working fine, long before I ever received an alert in Google Analytics for the Redundant Hostname issue.

That has already been done, and has not changed since.

If you look at the results, you will see that the sessions, users, and %of new users is not affected by the second tracking code.

Wouldn't they be affected just like pageviews / pages per session / bounce rate are if I am sending two pageviews instead of one in the same session?

Re: Why is the addition of a second Analytics Tracking Code affecting my stats?

Top Contributor
# 4
Top Contributor
You can send multiple hits in a session. Hits can be pageviews, events, ecommerce tracking and social interactions. Hits don't start a new session. Please check the document below about sessions:
https://support.google.com/analytics/answer/2731565?hl=en
If you place your tracking code twice on a page, the second instance will be simply ignored because the tracking script is already loaded and the tracking object is created by the first instance of the code. You cannot have two tracking objects with the same name. But the pageview request will be sent, so pageviews / pages per session / bounce rate will be affected.
Regarding the 301 redirects, if you go to Behavior -> Site Content -> All Pages and select Hostname as the secondary dimension, do you see only your preferred domain?

Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

Re: Why is the addition of a second Analytics Tracking Code affecting my stats?

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Just to be clear, I currently I have two different tracking codes implemented, not two instances of the same one...

So each one has a unique UA number.

When I go to go to Behavior -> Site Content -> All Pages and select Hostname as the secondary dimension, I see by far more visits to my preferred domain, but there are still some instances of the non-preferred domain (without www.)

What's strange though, is when i visit those pages without the www. included, they all redirect to the www. (preferred) version, so I do not understand how any of the non preferred are even being logged.

To be clear then, your advice is to remove the second instance of (unique) tracking code?

Re: Why is the addition of a second Analytics Tracking Code affecting my stats?

Top Contributor
# 6
Top Contributor
Hi,

If the second tracking code is for a different property then it should not affect your tracking as long as it is a named tracker. Make sure that it is implemented properly:
https://developers.google.com/analytics/devguides/collection/analyticsjs/creating-trackers#working_w...
If you could share your site URL I'd be glad to help with debugging.

Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

Re: Why is the addition of a second Analytics Tracking Code affecting my stats?

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
Thanks Arnold, sorry - I thought you had seen the URL from the screenshots I attached.

The site is www.sandpiperbeacon.com - and the preferred version is with the www.

I will use your link to ensure it is implemented properly in the meantime.

Thank You!

Re: Why is the addition of a second Analytics Tracking Code affecting my stats?

Visitor ✭ ✭ ✭
# 8
Visitor ✭ ✭ ✭
I think you can implement the second GA code as:

ga('create', 'UA-73579610-1', 'auto', 'newtracker');
ga('newtracker.send', 'pageview');

This will make sure not to mess up the first code tracking.

Re: Why is the addition of a second Analytics Tracking Code affecting my stats?

Top Contributor
# 9
Top Contributor
Hi Sandy,

Yes, you need to modify your tracking code to make the second tracker a named tracker. Currently you're double tracking the first property and the second property is not being tracked because a tracker with the same name cannot be created.

Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

Re: Why is the addition of a second Analytics Tracking Code affecting my stats?

Visitor ✭ ✭ ✭
# 10
Visitor ✭ ✭ ✭
Thanks, so is the solution that @chirag j suggested correct?