I have a website at mydomain.com that uses Analytics.

I have a blog that resides at mydomain.com/blog/, which also uses Analytics

They are on different profiles. The main site uses something like:

_gaq.push(['_setAccount', 'UA-XXXXXXXX-6']);

While the blog uses:

_gaq.push(['_setAccount', 'UA-XXXXXXXX-7']);
_gaq.push(['_setCookiePath', '/blog/']);

My issues is that this seems not to track referrals from the blog through to the main site when, for instance, the logo which links to the main site is clicked.

Ideally, I would like the clicks of this logo to report that the source was mydomain.com/blog/, but because they are at the same domain they seem to register as direct traffic.

Have I missed a step in my configuration, or will I have to resort to linking to something like mydomain.com?ref=blog?

Thank you.

3 Answers 3


My understanding was that _setDomainName('none') was used to seperate subdomains not subdirectories. Did this work for anybody?

I've tried the original scenario mentioned above by doctororange and got the same results - traffic from blog showing as direct traffic.

I also tried using profiles on the same domain and applied filters. In this case traffic showed from it's origninal source before the blog.

Is there any way to seperate a subdirectory so it's treated like a differnt domain I guess is my question!

I'm beginning to think it may be better just to use one profile and perhaps advanced segments.

  • Hi Dave. I'm accepting this because I too ended up using a single profile and advanced segments. I couldn't find a way to make a subdirectory behave as a different domain. May 2, 2012 at 12:01

Have you tried using the function "_setDomainName('none')". That way both URLs are treated as different, else you need to:


and set the backlinks to:

<a href="http://mydomain.com/blog/" onclick="_gaq.push(['_link','mydomain.com/blog/']);return false;">Link to blog</a>

as well as set:


and set links back via:

<a href="http://mydomain.com/" onclick="_gaq.push(['_link','mydomain.com']);return false;">Back to site</a>

I would advise you use the same tracking code for mydomain.com and for it's subdirectores like /blog/ and set up profiles for the site in you GA account for this. With a filter like "include only traffic to subdirectories that contain /blog/".

Use different tracking codes for different domains or subdomains, and not for subdirectories.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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