Question

I have over 100 fourth level domains that I want to roll up into a single property and Account for tracking.

Can I use a wildcard in the domain listing to include? Or do I need to specify all 100 subdomains (as it shows in the GA sample)?

I have the main property set to m.example.com in the GA settings.

In the tracking code I have:

ga('create', 'UA-XXX-Y', 'auto', { 'allowLinker': true });
ga('require', 'linker');
ga('linker:autoLink', ['*.m.example.com']);
ga('send', 'pageview');

Will that work? Or like in Classic, can I just set it to '.m.example.com'? Or do I need to list out each one like 'abc.m.example.com', 'something.m.example.com', 'different.m.example.com'

Example domains:

abc.m.example.com
something.m.example.com
different.m.example.com
etc.m.example.com

All of these share the same master template, and I'd like to set the code once and not have to maintain a hardcoded list of subdomains.

I have read the following, but it is still not clear to me with the new Universal Analytics:

https://developers.google.com/analytics/devguides/collection/analyticsjs/cross-domain

http://www.whymeasurethat.com/2013/05/10/universal-analytics-how-to-do-cross-domain-tracking/

Was it helpful?

Solution

So short answer for subdomains

All you need to do is add:

ga('create', 'UA-XXXXX-Y', 'auto');

The 'auto' will capture all the subdomains (as long as you have your GA code on the subdomains)

Longer answer You don't need to use the auto linker or anything like that for subdomains. That's why universal analytics is great. It writes the cookie to the top level domain. So it will look at .com and not be able to write for that then go to example.com and write the cookie there.

In Google Analytics you can then separate it by hostname.

For cross domain tracking you need to add some of the more advanced and load the auto linker method.

They talk about this a bunch in the beginning of the GA dec developer update http://www.youtube.com/watch?v=nmfUoSyFBSk

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top