The ROI Revolution Blog
« $6,000/month on Google AdWords w/o Google Analytics? | Main | Yahoo's Panama Project Revealed! »
Tracking Multiple Domains
September 26, 2006
Justin Cutroni has yet another great series of articles over at his blog, all about common Google Analytics configuration mistakes. His most recent post discusses third party domains, and getting Google Analytics to track across them. As usual, it's well-written and very informative.
One thing that many people don't know, however, is that, by default, Google Analytics will track only the request URI of its tagged pages.
What's the URI, you ask? Take a look at the URL below:

You see that the part of the URL that is surrounded by red is "/index.htm". So, when a visitor hits the page above, Google Analytics registers a unique visit to "/index.htm". Because the majority of Google Analytics profiles are focused on only one domain, the hostname (surrounded by blue) is ignored in the reports.
But what if you have two domains? And what if you have pages on both domains that have the very same URI?
We work with a client who wants to track visits across two of their domains. www.smithmountainhomes.com and www.smithmountainlakenews.com. Both of these domains have a default page called "index.htm". So, once tagged with the special Google Analytics JavaScript snippet required for cross-domain tracking, these two pages would begin to register views for the URI "/index.htm":

(Click the image above to view a larger version.)
These unique views would show up in Google Analytics aggregated into a single entry:
This is misleading data. We don't know which of those 371 unique views are attributed to each individual domain being tracked.
Fortunately, you can use an Advanced Filter to grab the hostname and insert it into your results:
Field A: Hostname -> Extract A: (.*)
Field B: Request URI -> Extract B: (.*)
Output To: Request URI -> Constructor: $A1$B1
Now both the URI and the hostname are being collected in your reports:
And you will be able to differentiate between the two pages very easily from within Google Analytics:
Need help tracking multiple domains in a single Google Analytics profile? Hire us to help you today.
Interested in learning more about Google Analytics?
Attend our LIVE Google Analytics Seminars for Success training in Atlanta, GA Wednesday, April 14th, 2010 and Thursday, April 15th, 2010 or get the latest tips and tricks sent to you via our free, twice-monthly Google Analytics newsletter.
Posted by Michael Harrison, Analytics and Optimization Specialist at 1:26 PM
Comments
@Cory: A filter applied to one profile should never affect data on another, and I've never seen any situations where it has.
October 11, 2007 3:57 PM
I am having problem while setting funnels. I have multipe entry like
Step 1 :
a)index.html
b)index2.html
c)index3.html
Step 2 : registeration.html and
Step 3 : logout.html
how to set funnels at the step 1, I mean how to set the 3 index pages at one step of funnel settings.
August 11, 2008 10:03 AM
@intelli: In this case, you can use regular expression goals to set step 1 to all three of your pages. Check out the official help section on regular expressions here: http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55582
August 12, 2008 10:29 AM
where to appl advance filter in main site profile or subdomain profile?
September 8, 2008 8:39 AM
@Anu: Apply it to the main site profile. You'll know that the subdomain/domain-only profile contains only pageviews from the appropriate domain or subdomain, so there's no need for the filter.
September 8, 2008 3:26 PM
Hi, Great tip here. However, once implemented, the content distinguishes between the pages "www.mydomain.com" and "mydomain.com". How would you cause the report to treat the pages above as 1 page?
September 11, 2008 12:05 PM
@Paul: One trick is to write a filter that, instead of adding the domain to the Request URI, just adds a short and easy-to-read word. It turns:
www.maindomain.com/page.html -> /main/page.html
www.shoppingdomain.com/page.html -> /shop/page.html
This consolidates them together and makes them easier to read in the Top Content report.
We cover this filter, as well as a number of other customizations, in our Google Analytics Implementation Training, which is given online and in person.
September 12, 2008 9:43 AM
I moved from the old ga code to the new tracking code and since then my cross domain tracking is not functioning. All inbound from the other site is showing as areferral. Can you see what I may have done incorrectly?
an example page:
http://www.mysterypartygames.com/Other_Mystery_Themes.html
here's my data:
from site A (outbound)
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
var pageTracker = _gat._getTracker("UA-29141x-1");
pageTracker._setDomainName("none");
pageTracker._setAllowLinker(true);
pageTracker._trackPageview();
from site B - inbound:
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
var pageTracker = _gat._getTracker("UA-29141x-1");
pageTracker._setDomainName("none");
pageTracker._setAllowLinker(true);
pageTracker._trackPageview();
October 5, 2008 2:25 PM
@Lou Anne: Be sure that you are following every item listed under the Google Analytics help article on multi-domain tracking, especially item #3. If you're not using the _link method to pass the data from one domain to the other, it won't work.
October 6, 2008 11:00 AM
Hi
I was just wondering if there is any way of posting data on google analytics without using javascripts. Any advice would be greatly appreciated.
Thanks a lot for your time.
January 13, 2009 3:22 PM
@Padma: Google Analytics is entirely dependent on JavaScript, so there is no way to post data to it without using JS.
January 29, 2009 1:55 PM
This filter is what I was looking for, however, applying it *seems* to break the navigation summary reports. Is that possible?
For example, looking at the navigation summary of the page www.domain1.com/product shows www.domain1.com/product/buy as the next page for some % of visits, but that's it. It stops there instead of showing www.checkout.com/step1 as the next page for at least some of the visits (just looking at the content overview shows that this page was indeed visited, and the referrer was domain1.com).
I'll be grateful if you can point me in the right direction.
Juvaly
March 13, 2009 12:14 PM
I've got this code working, and it works well. I'm interested to know, though, how this affects visits and AUV. For example, if a visitor comes to site1.com and links to site2.com, how many visits is that, and how many AUV? Is site1.com considered a referral to site2.com?
July 21, 2009 6:18 PM
@Jamiro: If you have it set up properly, it will not affect visits or AUV. site1.com would not be considered a referral to site2.com and the session would be bridged.
August 19, 2009 10:29 AM
Can I use the same code I got for one website on all other websites I want to track or do I sign up for a new tracking code for each website I want to track?
January 6, 2010 10:53 AM
@Victoria: It depends on whether you want to track all of the websites inside of a single Google Analytics profile, or if they should be separate.
Typically, I recommend one Google Analytics account per business (or per AdWords account), and then one code per distinct property. Keep in mind that Google Analytics doesn't have a one code : one profile ratio; you can have multiple profiles that use the same tracking code.
If you use the same tracking code throughout a bunch of different sites, then all of that data will make its way into a single profile. If you want to slice it up, you'll need to use filters or advanced segments, which might just make it more of a hassle to read.
Good luck!
Receive new blog posts immediately direct to your email inbox!














We used the above advanced filter for tracking unique urls on a profile for an account to see how well it would work. We had the original profile and a 2nd profile for this website. We put the advanced filter on the 2nd profile. The problem we encountered was that the original profile also seemed to be effected by the filter and the goals we had set up on the original profile were not being tracked correctly even though they had the complete page urls in the goal funnel. Should a filter you apply to a 2nd profile effect the original profile?
Thanks,
Cory
October 4, 2007 2:34 PM