问题
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.
回答1:
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
来源:https://stackoverflow.com/questions/10133880/google-analytics-track-two-domains-as-one