Tracking websites that have multiple sub domains may not seem like a complicated thing. In fact, the GA support docs clearly outlines two ways to track sub domains. You can track all sub domains in a single profile or you can track sub domains in separate profiles.
But what if you want more flexibility? What if you want to track one group of sub domains in one profile and a different group of sub domains in another profile? Or what if you want to create new profiles for a different groups of sub domains in the future?
I like to use an approach that let’s you decide how you want to group sub domain traffic. This setup will give you the most flexibility now and in the future. Some of the benefits include:
1. It let’s you collect all data in a master profile. This facilitates ‘roll up’ reporting and gives you an easy way to measure traffic to the primary domain and all of the sub domains.
2. This technique lets you track each individual sub domain in it’s own profile which is useful for deeper analysis.
3. You can easily create new profiles in the future based on groups of sub domains.
Here’s the exact process to get this working.
1. Create Profile for The Primary Domain
The first step is to create a master profile. All other profiles for the website, including profiles for the various sub domains, will be based on this profile. When you enter the domain for the website use the primary website domain. In the example below, I’m using www.sitedomain.com as the website domain.
After creating the profile GA will display the tracking code for the site. Before you add it to your pages it must be modified. You need to force GA to use the primary website domain for the cookie domain. This modification will let you track each unique visitor across all sub domains. This in turn let’s us collect all site data in a single profile and do ‘roll up’ reporting.
Old urchin.js tracking code:
New ga.js tracking code:
Use this profile as a way to measure overall traffic across all of your sub domains. To facilitate page analysis in this profile add a filter that concatenates the hostname to the Request URI, which is the piece of data in the Top Content report. This will help you differentiate traffic to pages with the same URI that may reside on different sub domains.
A handy report that you'll want to use in this profile is the Visitors > Network Properties > Hostnames report. This report will show traffic to the primary domain and all of the sub domains. It's an easy way to compare traffic to the various sub domains.
2. Create Profiles for All Sub Domains
Once you have created the master profile you can start creating profiles for each of the sub domains. Remember, each sub domain profile is based on the master profile, that we created in step 1. Here's how to set up the new profile:
Now that you've created the profile, make sure you add the tracking code to the pages on the sub domain. The tracking code for the sub domain is the same as the tracking code that goes on the primary domain (it's the code from step 1).
3. Add Filters to Sub Domain Profiles
The next step is to add a filter to the sub domain profile so it only contains data for the appropriate sub domain. This is done using an include filter based on the hostname. Once this filter is in place you'll have the master profile which will contain data for all sub domains, and this profile that will contain data for a specific sub domain.
To create additional profiles for other domains just repeat steps 2 and 3. Obviously the settings for the filter used in step 3 will depend on the sub domain that you want to include in the profile.
Creating Additional Profiles
Let's say you need to create a profile for two sub domains: 1.website.com and 2.website.com. This can easily be done because the same tracking code is on both sites. All you need to do is add an include filter with the following settings:
While Google's documentation describes a good way to track sub domains, I think this approach is better due to it's flexibility. Plus, because the same tracking code is used all all sub domains you don't need to worry about placing the wrong tracking code on a sub domain.
Good luck with your setup!
Hello,
I implemented GA on a big portal website. I did it the same way but I added some separate profile for each subdomains (add a profile for a new subdomains). It allows me seeing each subdomains as an independent website. Interesting at traffic source level.
JS for a subdomain look like this:
_uacct = “UA-xxxxx-15”;
urchinTracker();
_uff = 0;
_uacct = “UA-xxxxx-1″;
_udn=”domain.com”;
urchinTracker();
The problem is that you have to manage several tracking codes.
Note the _udn=”domain.com”; that avoid creating virtual traffic on domain.com due to the tracking code of the specific subdomain.
And _uff=0; that allows adding a second traffic code.
But I think that there is a problem at entry and exit page level as the entry page will not be logged for the second tracking code and the exit pages will not be logged for the first tracking code.
Hi there, since our site has added _udn = “domain.com”, the referrers from our own domain (“domain.com” ) have disappeared, which is what I expected. However, our subdomain is still showing up as a referrer. Is it supposed to be like that??
It seems to be causing a javascript error (_gat is not defined)
Any ideas?
Hi Scott,
Hmmmm… Although the new tracking code is still in Beta, I’m running it on a number of sites without any issues. I would check to insure that the GA code is not interfering with existing JS code.
Justin
Hi Justin,
I searched all of the GA code and found no reference to _gat – am I missing a file? The website in question is http://www.casobi.com
I wanna change the tracking code, but I am not sure if the first line
is needed in the new code as well. Or do I have to change “urchin.js” in “ga.js”?
Hi Scott,
when I set up the profiles as you did it, then “sitedomain.com” is the profile with all the stats. How do I set up a profile only for the traffic from sitedomain.com? With hostname filter with “sitedomain\.com”?
The next questions is, when I want to view the traffic from forum.sitedomain.com/test, I set up that filter “forum\.sitedomain\.com/test”
Hi Jenny,
It may be that the traffic from the sub domain is legacy traffic, people that still have that value stored in their cookies.
Justin
Hi Scott,
The new code is still in beta, it could be that it is not working with some code on your site. I have seen some minor issues with certain sites using array prototypes, but no widespread issues. I would check the interaction with the code on your site.
There is no info on _gat because this stuff is really new. There’s little to no info out there.
Hope that helps,
Justin
Hi Roos,
I would hold off on changing your code if you don’t understand the instructions. It’s still in beta so there is very little support available if things don’t work out.
Sorry!
Justin
Hi Justin,
if the site is already running and the main domain is already coded, do we have to include the _udn in it as well? Or adding _udn to the subdomains is enough?
Thank you.
Hi Justin,
I have been experiencing problems with the advanced profile you described earlier. After implementing the filter, the url’s in my content reports are no longer functional. I believe by telling GA to place the hostname before the request uri, the content line item appears as – /www.domain.com/domain.com/widgets.com. If the client were to want to view this link, it would return a 404 page not found, since the domain name duplicates itself.
Any insight to this??
Jonathan,
Yes, you are correct. The advanced filter will break the ‘click-through’ capability for that profile. Unfortunately the only solution is to remove the filter. However this could make the data more difficult to understand. You’ll have to choose which feature is more important.
Sorry about the confusion and I hope that helps. Thanks for reading.
Justin
Hello,
I’m now using the original code, but I have some problems.
I’m using GA for testing at moc.ingame.de, doom3.ingame.de and forum.ingame.de/sims.
The global profile is ingame.de. There I have all the traffic from those three “sites” like I want it. Also the profiles for “moc.ingame.de”, “doom3.ingame.de” and “moc.ingame.de, doom3.ingame.de” are working well.
In my global profile I’m getting the data from forum.ingame.de/sims, but in the seperate profile nothing is to see. I’ve set up this filter for the seperate profile:
Custom filter | include | Hostname | forum\.ingame\.de/sims | no
Can you tell me where the mistake is?
Roos,
It sounds like you need to set the _udn variable so you have a unified cookie across all the sub domains. The way you have it set up now your main profile will have incorrect data for unique visitors. You want one cookie for each visitor and you want that cookie to be used by each sub domain. That’s where the _udn variable comes in.
Once you have a unified cookie across all the sub domains you should be able to see the appropriate hosts as I describe in the post.
Hope that helps,
Justin
Hope that helps.
Hello,
I was getting errors from the Firebud FF extension as well. It complained, saying that “_gat is not defined” until I added the following type check:
if (typeof(_gat) == ‘object’)
{
var pageTracker = _gat._getTracker(“UA-xxxxxxx-x”);
pageTracker._initData();
pageTracker._trackPageview();
}
Scott,
Most likely the error you’re getting is due to a content blocker – adblock plus, perhaps? – in your browser. I had the same issue, turned off adblock (for my site, at least), and the problem went away.
Hi Justin,
would it solve my problme if I use the new ga.js tracking code with the followinh code line?
“pageTracker._setDomainName(“sitedomain.com”);”
Or should I add this line
“_udn = “sitedomain.com”;”
to the old tracking code?
Sincerly Fabian
Fabian,
You should use the code that is appropriate the version of the GATC that you are using. Either way, setting the domain name to sitedomain.com is the first step to fixing the problem. Once you update the code you’ll need to create the appropriate profile filters to segment the data.
HTH,
Justin
I have created a profile in order to give an advertiser access to my stats. However I don’t want to grant access to *all* the stats. is it possible to control what reports are available to a profile?
Scott,Jim: _gat blocked problem solved.
Gat object is not defined, because google analytics javascript is not loaded. Try putting http://www.google-analytics.com/ga.js in your browser address bar. If you don’t get javascript code, that’s it. I.e. my free wifi provider blocks whole analytics domain, so I get “content blocked” page instead of javascript code.
Hi Steve,
Unfortunately, no. There are only two levels of access to GA: user and administrator. If you give someone user access they can see all of the reports in a profile.
Thanks for reading,
Justin
So to be clear on this whole thing…
If I use the above implementation I should be able to get visitor stats (#unique visitors and their demographics, etc) for each subdomain PLUS a grand tally when looking under the primary domain?
Thanks
Chuck
Hey Chuck,
You’re right on the money. Thanks for the comment and thanks for reading.
Justin
Thanks for the tutorial. The GA doc is really lacking. Yes, they do give you instructions, but absolutely no examples or context in which to apply the instructions. The reasons this is so important is it takes time to test these permutations on GA since the reporting isn’t in realtime. You’ve saved me some work. Thanks!
PS seems to work well. I haven’t updated to the new tracker yet.
Hello Justin,
I have a question regarding a situation that looks like sub domain tracking but is more like the opposite of it.
One of our clients created a specific zone on his domain. This zone can be considered a “seperate website”. http://www.site.com/web.aspx?p=1234 is the “homepage” of this homepage.
Google analytics won’t accept creating a seperate profile for this kind of url. So I guess, they only way to make this work is to create a seperate profile for the main domain (www.site.com) and applying some filtering to include only the pages (web.aspx?p=1234 etc.) of this zone (aka seperate website on the same domain).
But we really need to know the range of numbers (p=x) the content management system will create in order to apply a RE filter and make this work.
What do you think?
Vladimir
Hi Vladimir,
You could also create the profile based on some other attribute, like the page title. If this section of the site is different then try to find some filter field that has a unique attribute for that section.
Another alternative would be to prograatically manipulate the urchinTracker() function and pass it a different value to create a unique pageview for that section. You can read more about manipulating urchinTracker() in my series on Tracking Clicks.
Hope that helps,
Justin
Hello Justin
I have had so many problems with google tracking (I could write a book) over the last 18 months that I don’t really know where to start, but my first point is that I try to track domains (not subdomains) parked with my website selme.com
I have found tracking scripts for the old urchin tracker on the web, but not for the new tracker.
My first question is if I implement _udn=”selme.com”; in the old urchin script call, what is your recommended way of coding analytics filter to pick up ALL selme.com traffic AND other domain traffic?
By this I mean that some domains have DNS pointers to selme.com and point at the same website but with their appropiate domain name.
For example http://www.lovingdays.com has DNS pointing at http://www.selme.com and I need to improve on the method I use to try and capture analytics activity analysis.
Any help you can give would be much appreciated
Thanks
Peter
Peter,
Google Analytics is a JavaScript based tracking tool, which means that is will only track information that is available in the browser. So, if you have a number of domains that are all directed to one site GA will not differentiate traffic to the individual domains. Remember, it can only identify the domain name that appears in the browser when the site loads.
If you’re interested in the traffic to all of your aliases then you may want to consider changing the way the DNS resolves. However, you can’t have it both ways. In this case you would see data for all domains in a single profile, and then be able to create individual profiles based on a Hostname include filter.
Thanks for the question,
Justin
Justin
basically I add a reference to DNS parked domains (pre-process and single redirect before landing page) i.e. http://www.ekisses.co.uk/ is given a ref=xxxxxx in its URL and I see the goals (reverse goal path) in my analytics output for these. I use free goal trackers I found (asclick and astrack – both for urchin.js only) but I do not specify _udn=”selme.com”;
I also use ‘head match’ for goals..
My question is if I implement _udn=”selme.com”; goal tracking, will it only pickup url calls from http://www.selme.com and exclude http://www.ekisses.co.uk?ref=xxxxxx??? for ‘head matches’?
I am trying to understand the business of when/when not to specify _udn=”selme.com”; and the effects.. If specified, does it only pickup up domains beginning selme.com??
It has been trial and error and I just wondered if you could enlighten me on what you know.
Thanks so much for this post! It’s a lot more clear and easier to understand than Google’s FAQ. Kudos to you!
Peter,
You only nee to add the _udn=”domain” if you wish to track unique visitors across multiple sub domains. Changing udn modifies the GA tracking cookie domain, thus allowing the cookie to be read by multiple sub-domains. Changing udn has no effect on goal tracking, it just effects the cookies.
If you site is not using sub domains OR if you are NOT tracking visitors across multiple domains, then you should not tweak udn.
I hope this helps. It is difficult to troubleshoot some of these issues via comments.
Thanks for reading,
Justin
Justin,
What if we already have multiple profiles for different subdomains with different UA number for each and we want to integrate all these subdomains under a single UA number, how can we do it without loosing all the analytics data we have so far with the current profiles.
Is there a way that we can implement what you suggested here and still retain the data from our previous profiles??
Thanks,
Jahangir
Hi Jahangir,
Unfortunately no, there is no way to implement this solution and retain historical data. The reason is that the data has already been spread out to all the different account numbers. There is no way to “move” the GA data between account numbers once it has been split.
Thanks for the question,
Justin
Hi Justin
I want to filter traffic for several directories under one profile – specifically all traffic to:
http://www.derby.ac.uk/online
http://www.derby.ac.uk/e-learning, and
http://www.derby.ac.uk/elearning
Google says they don’t recommend you adding more than one directory include to one profile – so can I use custom filters to do this?
Lucy
Hi Lucy,
You can absolutely create a profile to include those three directories. You’ll need to use a custom include filter with a regular expression for the filter to work correctly.
It should look something like this:
^/(online|e-learning|elearning)/
Make sure you test the filter on a test profile before you apply it to some “real” data.
Justin
Thank you for this article but I have a question that I not sure if this will work for me.
I want be able to create a sub domain for each user and give them information about how many people come to that page and from where, etc. On there own page.
The site would be laid out as bob.mysite.com or bill.mysite.com etc.
If I understand how this setup works for each sub domain I will have to create a new profile in GA.
And to get the report data on the users page I will need to have GA email the XML report, for each sub domain. Then I will have to parse each sub domain’s XML file.
I don’t mind doing the work to create a script that parse the XML data. Thats a one time task, but having to create a GA profile for each sub domains is a lot of work. If I have 10,000 users, I will have to create 10,000 profiles.
My question is there an easier/better way have GA track each sub domain and not have to create a profile for each user?
Thanks for your time.
For the people who have followed this article and are gettin “_gat is undefined” error, check if you have the http://www.google-analytics.com/ga.js included.
Because it was not explicitely mentioned in this article. Check http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55524 for the article on the official site. Following code should be added:
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”));
Hope this helps …
Kevin,
Thanks for the comment. I should have pointed out that you need to modify the tracking code, not just add the code in my article to the site.
In general, the code on this site is just an example and should be customized and tested for your specific implementation.
Thanks again for the comment.
Justin
Justin,
I’m in a university environment and want to use a single tracking code across multiple sub domains AND sub directories. Is this possible with a single set of code as described in your original example or would we need one for the sub domain sites and a slightly different version for the sub directory sites? If the versions need to be different would you also comment on any needed changes to profile set-up? Many thanks.
Therese,
You can use the implementation technique that I describe in the article above. This will let you track all traffic to all of your sub domains and all of your sub directories in a single GA profile. It will also give you the flexibility to segment the data into additional profiles based on the sub domain or the sub directory.
Creating additional profiles can be especially helpful when you want to limit the data that certain users have access to. For example, you could create an ‘alumni’ profile and then restrict access to those that work with alumni. It all depends on your needs.
Hope that helps and thanks for reading.
Justin
Hi Justin
I’ve got a problem with tracking a sub domain and hope you can help! Your instructions above are great.
We have the main domain: gosh.org and a subdomain shop.gosh.org
We are using the old code. I have the same tracking code on both sites.
I wasn’t using the “_udn” bit of the code to get a single view, but am now in the process of implementing that. It’s just gone live on shop.gosh.org but not on gosh.org yet.
Anyway – the problem is that I’m not getting any stats for the shop and can’t see why? I have it coming into my main profile obviously and have also set up a seperate profile with an include filter by Hostname.
Can you think of any reason why the tracking wouldn’t be working?
We have some pages on a different domain at donate.gosh.org and they are working OK.
Thanks!
Rachel
Justin-
Just wanted to let you know about a quick correction in your code above. You have
pageTracker._setDomainName(“sitedomain.com”);
This should be
pageTracker._setDomainName(“.sitedomain.com”);
Per the google docs:
http://code.google.com/apis/analytics/docs/gaJSApi.html#_gat.GA_Tracker_._setDomainName
“Be sure to use a leading “.” in front of your domain name, as illustrated here. The leading period ensures that the cookie will be accessible across all hosts. Otherwise, the cookie is accessible only in example.com.”
David: Thanks for pointing that out. There has been a lot of confusion on the exact format as some Google documents do not show the leading period. In our tests we have not see any problems with omitting the period. It does not appear that the period affects the cookie domain.
Rachel: If you’re not seeing any data I would double check your filters. It may be that your include filter is incorrect. Also check the Hostnames report. Are you seeing the shop.gosh.org domain in that report? If not, then the issue is probably due to the tracking code implementation or a filter.
Thanks to you both,
Justin
Hi there,
I have, somewhat, successfully set this up. I have 1 main domain, and several groups of sub-domains.
The problem I am having is that each profile has a a visitor count, however the sub-domain profiles don’t have anything else, there is no data in the content sections, traffic sources, etc.
Can anyone assist with this issue?
Thanks in advanced.
Jenny,
Just to be clear, you’re seeing visits in the sub domain profiles but no other data, like pageviews? That’s seems really strange, I’ve never come across that problem before.
My initial reaction was that your sub domain specific profiles don’t have any data. In that case I would suggest checking your filters to make sure they’re correct.
But I’m not sure why you would be seeing some metrics, like visits, and not others, like pageviews, etc.
Sorry, that’s a new one on me.
Justin
Hi Justin,
That is correct, I am seeing visit data but nothing else.
This is what is displayed on the main screen of one of my sub-domain setups:
2,929 Visits
0 Page Views
0.00 Pages/Visit
Very odd!
Actually, both of my sub-domain setups are reporting the same amount of visits.
My Filter Setup:
Sub Domain 1 Setup: Include / Hostname / sub1.maindomain.com
Sub Domain 2 Setup: Include / Hostname / sub2.maindomain.com
Any assistance would be greatly appreciated.
Cheers,
Jenny
Jenny,
My guess is that you’re doing something with custom segmentation. That’s the only thing that I can think of. Sometime, when custom segmentation is used, GA will create visits but not pageviews.
That’s my best guess without actually being able to work on the site.
Justin
Hi,
We installed the code & the filter and it is working properly. However, one problem that we are having is in the Content Overview report, analytics now distinguishes between “www.domainname.com” and “domainname.com”, depending on how the visitor enters the site. What do i need to do so that the report will treat these as the same page?
I have a something.site.com. This is the shopping cart. I also have http://www.site.com. These are all the content pages. All the content pages send users to the cart. All the transactions that are recorded come in with a referral of http://www.site.com which logically makes sense, but in reality there are other referrals.
I have tried to set the pageTracker._setDomainName(“site.com”);
so that there is a consistent cookie on both the subdomain and the domain, however, all the transactions still come in with the referral being http://www.site.com
Anything I am missing?
Hi Mike,
Seems like you’ve done everything you need to. I know this sounds silly, but you might want to adjust the date range to view traffic for the days immediately after the change. It may be that the historical data is pushing the real referral traffic down.
Hope that helps and thanks for the question.
Justin
Thanks for the attention Justin.
I have also used your Trans Mods (the custom filters) to see where my transactions are coming from. I made the change on Thursday and it’s Monday. I still see ALL the transactions on something.site.com like this
#1234 site.com-referral
The Analytics keep seeing http://www.site.com as the referral. I looked at the cookies. It says the same thing.
Mike,
The only other thing I can think of is that there is something interfering with the cookies. It’s tough to say without seeing the exact site.
Sorry I can’t be more help,
Justin
I have 3 domain name all pointing to the same web server and application. Eg http://www.first.com, http://www.second.com, http://www.third.com , all these point to same web server/application. How can I track visits to each of them separately under one profile?
Anand,
If each domain resolves to a different domain name, then you don’t need to worry about anything. Google Analytics will use a first party cookie to track visitors. So, when a visitor lands on http://www.first.com then they will receive a cookie, specific to http://www.first.com, Then when they go to http://www.second.com they will get a different cookie for second.com. Just make sure that you put a different tracking code on each site or all of the data will end up in one profile, which could be fine if you want all the data for all the sites to be aggregated.
Hope that helps,
Justin
Justin, thanks again for such a great resource.
Thanks to your posts and guide, we are almost fully migrated from HBX to GA for our social network. We utilize subdomains (about 30 total) for various sections and communities.
We have one global instance of the js code on all pages and using _setDomainName and filters, we have a rollup profile and one for each subdomain.
The rollup is working fine but the subdomain profiles are counting visits incorrectly. Within the subdomain profiles, GA is showing that there are more visits then there are pageviews. Looking at yesterday’s data – 11,500 visits but only 4,500 pageviews.
If it makes any difference, we are using _setVar to pass in info about our members (age, gender, etc.).
The filter is setup as described above: Custom Filter – Include – Hostname – subdomain\.root\.com
If we can get this figured out, we’ll be fully moved over from HBX!
Thanks.
Just to clarify – it looks like they are counting the correct number of pageviews.
Hi Justin, I have a problem with tracking visitors across multiple subdomains and root domains.
My website http://www.site1.com has many subdomains such as page1.site1.com, page2.site1.com etc. From the subdomain pages, there is a form that sends visitors to another domain secure.site2.com.
How do I successfully track visitors to both the subdomains and through to the other domain and still keep accurate referral data. At the moment, referral data for secure.site2.com credits subdomain.site1.com
In addition to my previous question, I use setallowlinker(true) and setdomainname(none) on both websites. However the setdomainname(none) creates problems with the subdomains on site.com.
Also, i have added an onsubmit linkbypost(this) code to the php form (I’m assuming the form uses method=post – it actually doesn’t state whether it is a get or a post) but the cookie data isn’t showing up in the posted url. I am at my wits end here – any help would be appreciated.
Great post, it’s the main post in Google for this kind of search which shows its worth..!
One quick question. We have this setup running quite nicely, but my only niggle is that the referrers report shows the main domain and the sub-domains as referrers. Having not used GA on another website properly before, does this usually happen in GA where it names the name of the website/websites that are tagged as top referrers?
It doesn’t really give an accurate view of where your traffic is coming from – is there a suggested filter which can get round this problem?
Thanks – Chris
Chris,
If you’re seeing the website, or one of its sub domains as the main referrer then there could be an issue with the tracking cookies OR there may be some type of frame or iframe on the site. While it’s impossible to completely eliminate self referrals, they usually are not #1 and #2 in the referral list.
Thanks for the question,
Justin
Hi Justin,
I’ve found your tutorial really helpfull. I’ve found also a similar implementation reported by Brian Clifton on “Advanced Web Metrics with GA”.
It seems working but I’m still experiencing problem with the referral as everybody here in the post. Do you think we should post bug report to GA dev team? Check on gorilla.cd but I think implementation is right..
just a quick help for people still looking for help.
I’ve solved the referrer problem, may be it’s not the clean way but just add a call to your tracking system like this:
pageTracker._addIgnoredRef(“domain.tld”);
Good luck everybody
Hey Justin!
Great tutorial!
I just set it all up and on my site I have ALOT of subdomains. Ive just finished doing most of them but its made my account very messy. I thought the whole idea of adding a profile to an existing domain was to make it neater and have it “nested” almost. When as to get to them you have to click on the main domain.
BUT
At the momment every single one is listed on my front page of my Analytics account and is getting messy!
Anyway around that?
Thanks
Matthew
I have a main site using Joomla. I have embedded the GA code at the right spot and it is tracking. We have decided to put up a WordPress blog in a subdirectory. Should I copy the GA Code into the right part of the WordPress theme as well?
Thanks!! Great site.
Hi Justin
Is it:
pageTracker._setDomainName(“sitedomain.com”);
or
pageTracker._setDomainName(“.sitedomain.com”);
or does it matter?
Your article and Brian Clifton’s book don’t have the ‘.’ but the Google help page does!
Thanks for any help.
George
Justin,
I set up my analytics profiles based on your tutorial although I have one question regarding the sub-domain profile.
Should the website URL under settings match the sub-domain (ie subdomain.site.com) or should it remain the same as the main profile (www.site.com)?
Thanks
Tom,
If you don’t add the tracking code then you won’t track the WordPress section with GA. If you don’t want any insight into what happens on the WordPress section then leave the GA code off ;)
Justin
George,
I’ve seen conflicting documentation. Some has it, some does not. I say go with the GA docs.
Justin
Nez,
Great question. You should add the sub domain to the website URL setting. This way the site overlay report will work for your sub domain profiles.
Thanks for the question,
Justin
Great article!
A couple of follow up questions.
1. what if I don’t want a master profile that rolls up all the subdomains? for example – I want to create another profile that is used only for testing purposes in a QA / Dev environment. In this case, do I not add the additional line of code – pageTracker._setDomainName(“sitedomain.com”) ?
2. On the production profile, can I use the same method used for creating a subdomain profile to exclude the subdomain from the production profile? So instead of include, I create a filter that says exclude – hostename – subdomain\.mydomain.\com?
thanks
Chris,
1. If you want to create a toally separate profile, that will never have the data, then no, you don’t need to the _setDomainName line of code. Just remember that when you do roll into production, and you want to have all the sub domains rolled up, then you will need to add that extra line of code.
2. Yes, creating an exclude filter would follow the same process as an include filter.
Thanks for the questions and thanks for reading the blog.
Justin
Wow! Thanks Justin!
Just want to add my praises for your succint and brilliantly illustrated tutorial. It even worked for a plough-horse like me ;)
You’ve been a great help to me today – so I’m sending you all the positivity I can >>mmmmh<< – there you go! Hope it arrives,
J
Finally a great thorough post on how to segregate profiles properly! Thank you!