1

At work we have two domains that serve the exact same website/code/etc. I'm trying to find out if there is a way to track them through Google Analytics and have a single account that could not care less which domain it's serving analytics data for? The issue that I have currently is that the domain that we use for advertising is showing up as a referrer which is hiding (or at least I don't know how to find) what the true source was (google/bing/yahoo/etc).

Please note... After searching on here I just wanted to add this to hopefully make it 100% clear. I don't want to track the two domains individually...I want my GA account to merge the data without regard to what domain the users browser shows.

ThomasRedstone
  • 379
  • 1
  • 4
  • 13
Jared
  • 5,840
  • 5
  • 49
  • 83

1 Answers1

2

Why would you want that anyways?

Having 2 domains serve the same content could be counted as duplicate content and could screw up your google ranking. I advice to redirect one domain to the other so 1 domain actually handles the website and the other just catches visitors.

If you would like to do it anyways

var pageTracker = _gat._getTracker("UA-12345-1");
pageTracker._setDomainName("none");
pageTracker._setAllowLinker(true);
pageTracker._trackPageview();

But you also need to edit all your links, read the article below.

http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55503

Scriptor
  • 1,125
  • 1
  • 6
  • 13
  • I wish I could do that, but due to Microsoft Adcenters retarded rules I can't forward so I need the ability to do as I described – Jared Apr 13 '12 at 19:22
  • It appears through reading the link that you posted that I'd need a different script for each domain in order to set the `_setDomainName` which I was hoping to avoid. Is this how you understand it? If that's what's required I can generate that serverside...I just want to make sure it's right I guess! – Jared Apr 13 '12 at 19:26
  • No, in that case you should read this article: http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55503 Also updated my main post. – Scriptor Apr 13 '12 at 22:03
  • I want to do the same thing as the author but I don't know where you mean to put this code? I'm doing the asychronos way ... ``var _gaq = _gaq || []; $(document).ready(function() { _gaq.push(['_setAccount', ...`` ? Where would I put this? ``_gaq.push(['_setDomainName', 'none');`` ? – OZZIE Jun 14 '13 at 12:45
  • Also I want to do this because one domain is in English and the other in Swedish so it shouldn't be counted as duplicate – OZZIE Jun 14 '13 at 12:48
  • For the sake of those coming now to this answer, the links aren't working anymore. The current link is: https://support.google.com/analytics/answer/1034342?hl=en – Leon Oct 22 '13 at 09:35
  • is it possible to track 25 websites using a single code? I would like to know how many people visited each site without creating 25 websites separately.. – Mano Haran Jun 24 '16 at 11:56