Universal analytics cross-domain tracking setup?
-
I'm a bit confused on the implementation aspect for Universal Analytics. Suppose I have a primary domain site (www.abc.com) and utilize a third party to host our shopping cart (www.abc-cart.com). Both domains have links referring traffic to one another. Can you tell me if the following cross-domain tracking codes snippets are correct for the primary domain and third party site. Also, do I need to specify the respective domain parameter within the first line of code on both sites? I've seen some sites have the domain parameter removed within ga('create'....
- Primary domain pages:
ga('create', 'UA-XXXXXXX-X', 'abc.com', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['abc-cart.com']);
ga('send', 'pageview');
- Third party domain pages:
ga(‘create’, 'UA-XXXXXXX-X', 'abc-cart.com' { ‘allowLinker’: true });
ga('require', 'linker');
ga('linker:autoLink', ['abc.com']);
ga('send', 'pageview');
-
Hi Liamis,
All the tags look good except the fact that: ga('create', 'UA-XXXXXXX-X', 'abc.com', {'allowLinker': true}); should be without abc.com so: ga('create', 'UA-XXXXXXX-X', {'allowLinker': true});. I can't find anything in the documentation as well which tells that you should include the domain name there again.
-
Thanks Martijn, I figured the domain name doesn't needed to be included, but just wanted to be sure for Universal Analytics.
Thanks,
Brian