1

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/

1 Answer 1

2

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

4
  • Some clarifying questions. 1) So I do not need to specify the domain in the tracking script at all? 2) I have the "Default URL" in the Property Settings set to m.example.com, is that correct? 3) If that is correct, will then look at all traffic at the third domain ("m.") level and fourth ("abc."), but not the second ("example.") domain level?
    – User970008
    Commented Jan 14, 2014 at 19:36
  • If you use 'auto' in the top line you don't need to specify the domain. Default URL is more for your own way of keeping stuff organized. I used UA codes with default URL on different URLs when I'm testing stuff. Basically your code will just be ga('create', 'UA-XXX-Y', 'auto'); ga('send', 'pageview'); you can also use the domain name instead of auto if you wanted but I wouldn't recommend it. Does that answer your question?
    – NicoM
    Commented Jan 14, 2014 at 21:32
  • NicoM, how do you setup 'auto' in GTM? Commented Jan 16, 2014 at 17:24
  • It should be automatically added if you're using Universal Analytics. In the video I posted about the dec dev updates the Google team mentioned that this is the new standard moving forward. So I would think that it is automatically added in to GTM.
    – NicoM
    Commented Jan 20, 2014 at 21:47

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.