Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to track traffic for my sub-domain, but it's not happening.
This is how it's set up.

My partner has a domain called sub1.partner.com. This domain points to partner1.mydomain.com. The idea is that users think they are browsing my partners website, when they are in fact browsing pages on my server.

My tracking code looks like this:

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxxxx-x']);
_gaq.push(['_setDomainName', '.mysite.com']);

(function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

In Google analytics I've created a new account under my main account and called in partner1.mysite.com.

On this account I have created a filter:

Filter type: include
Filter field: Host name
Filter pattern: partner1.mysite.no
Case sensetive: No

What more can I try to track traffic on my subdomain?


Question 1
Is this line correct?

_gaq.push(['_setDomainName', '.mysite.com']);

Question 2
Is it correct that I have to add \ before any punctuations like so \. in filters?

share|improve this question
Have you tried removing the filter? I don't see why you would have a problem if you copied and pasted the code directly from the new analytics profile into your sub-domain html files. – Anagio Mar 12 '12 at 13:46
From what I have read in various guides, the correct way is not to add another js script to the footer for the subdomain, but rather create a new profile and add a filter for this. – Steven Mar 12 '12 at 15:11

Here are some resources on how to track a sub-domain in GA





share|improve this answer
Iv'e already been to most of these links. But I still get no result. Need some concrete suggestions on what to try. – Steven Mar 13 '12 at 9:34
In that case I would contact Google Analytics they can review your tracking code and configuration for you. If you have an adwords account login go through the contact form for Analytics within adwords. Also try posting in the analytics group in Google you may find some certified companies who know the code inside and out. – Anagio Mar 13 '12 at 11:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.