Mobile app version of vmapp.org
Login or Join
Megan663

: Correct configuration of multiple Analytics trackers per page, spanning domains and subdomains My company publishes sites on a somewhat convoluted domain structure, and we're having trouble getting

@Megan663

Posted in: #GoogleAnalytics

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.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Megan663

2 Comments

Sorted by latest first Latest Oldest Best

 

@Deb1703797

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.

10% popularity Vote Up Vote Down


 

@Rivera981

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:
developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite#multipleDomains

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme