Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

My company publishes sites on a somewhat convoluted domain structure, and we're having trouble getting accurate numbers in Analytics when we have multiple trackers on the page.

We publish under two brands (A, B). Each brand has a "national" site at A.com, B.com, as well as per-city "local" sites at eg. ny.A.com, la.A.com, sf.A.com, etc.

Right now we're trying to track in these dimensions:

  • Full network (A.com, ny.A.com, B.com, la.B.com, etc.)
  • All sites in brand (A.com, ny.A.com, la.A.com, etc.)
  • Inidividual site (ny.A.com)

Here are the commands we're using on an individual site:

_gaq.push(
    ['t0._setAccount', 'UA-XXXXXX-1'],  // full network
    ['t0._setDomainName', 'none'],
    ['t0._setAllowLinker', true],
    ['t0._trackPageview'],
    ['t1._trackPageLoadTime'],
    ['t1._setAccount', 'UA-XXXXXX-2'],  // brand
    ['t1._setDomainName', 'none'],
    ['t1._setAllowLinker', true],
    ['t1._trackPageview'],
    ['t1._trackPageLoadTime'],
    ['t2._setAccount', 'UA-XXXXXX-3'],  // individual
    ['t2._setDomainName', 'none'],
    ['t2._setAllowLinker', true],
    ['t2._trackPageview'],
    ['t2._trackPageLoadTime']
);

We send the same commands to each account because we've had strange results when trackers were configured differently in the past. However, right now we're seeing inflated numbers for uniques on all three trackers.

What is the correct way to configure this setup? Thanks for your time.

share|improve this question
    
Strongly suggest you moved to a paid for solution with a more flexible tag, GA isn't well designed for applications like this. –  toomanyairmiles Jun 5 '12 at 21:38
    
Clicky? Webtrends? If you've successfully implemented one for this kind of topology, I'd love to hear about it. Thanks. –  slowernet Jun 5 '12 at 21:45

2 Answers 2

I am a colleague of the original poster. The main problem here, it turns out, was a minor typo in the fifth line of the tracking code for the full network:

...
['t0._setAccount', 'UA-XXXXXX-1'],  // full network
['t0._setDomainName', 'none'],
['t0._setAllowLinker', true],
['t0._trackPageview'],
['t1._trackPageLoadTime'],          <== oops, "t1" here should be "t0"
...

Even though it seems like this should, at worst, affect only the page load time statistic, it was actually affecting unique counts as well. Fixing this typo alone brought the vastly over-inflated unique counts back down to realistic levels.

Later on, we also implemented the suggestions in @eduardocereto's answer, removing the obsolete "trackPageLoadTime" lines altogether, and explicitly setting the domain names to prevent possible future unique mis-counts.

share|improve this answer

You need to setup it to work for cross domain and subdomains.

Use this one for site A.com

_gaq.push(
    ['t0._setAccount', 'UA-XXXXXX-1'],  // full network
    ['t0._setAllowLinker', true],
    ['t0._setDomainName', 'A.com'],
    ['t0._trackPageview'],
    ['t1._setAccount', 'UA-XXXXXX-2'],  // brand
    ['t1._setAllowLinker', true],
    ['t1._setDomainName', 'A.com'],
    ['t1._trackPageview'],
    ['t2._setAccount', 'UA-XXXXXX-3'],  // individual
    ['t2._setAllowLinker', true],
    ['t2._setDomainName', 'A.com'],
    ['t2._trackPageview'],
);

And this one for site B.com

_gaq.push(
    ['t0._setAccount', 'UA-XXXXXX-1'],  // full network
    ['t0._setAllowLinker', true],
    ['t0._setDomainName', 'B.com'],
    ['t0._trackPageview'],
    ['t1._setAccount', 'UA-XXXXXX-2'],  // brand
    ['t1._setAllowLinker', true],
    ['t1._setDomainName', 'B.com'],
    ['t1._trackPageview'],
    ['t2._setAccount', 'UA-XXXXXX-3'],  // individual
    ['t2._setAllowLinker', true],
    ['t2._setDomainName', 'B.com'],
    ['t2._trackPageview'],
);

You also need to tag the links from domain A.com to domain B.com and vice-versa using the _link function.

_trackPageLoadTime is now a default setting, you don't need to call it.

_setDomainName, none is the same as the default _setDomainName, auto + _setAllowHash, false. _setAllowHash is deprecated and you should avoid it at all costs, specially on large deployments and structures like that. It can cause severe problems when you have different sets of cookies that cause over counting of visits and visitors.

By having the top level domain as your _setDomainName you ensure that the google analytics cookies will be stored on the top level domain. So they can be reached and shared on all subdomains of A.com. Note that the code changes for every domain,

To read more on how to implement Google Analytics on multiple domains and subdomains read the following resource:

https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite#multipleDomains

share|improve this answer
1  
The problem, it turns out, was a typo in the tracker code (see my answer for explanation). Your answer was helpful though, and taught me some things I didn't know about GA, so I'm awarding you the bounty. –  Ben Lee Oct 9 '12 at 20:57

Your Answer

 
discard

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.