I have a question about setting up Cross-Domain Tracking in Universal Analytics (analytics.js).
I have a virtual store and you use the domain www.dominioA.com.br, and the verification is performed in another domain www.dominioB.com.br
Google Analytics Classic (ga.js) uses the following code:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-99999999-9']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
In the transition from domain A to domain B, which is FORM / POST, the following code is used:
_gaq.push (['_linkByPost' document.Form]);
Thus, domain B can read cookies from domain A and work correctly in the transition domain.
I upgrade to Universal Analytics (analytics.js) and read the instructions in the following article:
https://developers.google.com/analytics/devguides/collection/analyticsjs/cross-domain
, www.dominioA.com.br, :
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-99999999-9', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['www.dominioB.com.br'] );
ga('send', 'pageview');
</script>
, www.dominioB.com.br, :
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-99999999-9', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['www.dominioA.com.br'] );
ga('send', 'pageview');
</script>
" " :
https://developers.google.com/analytics/devguides/collection/upgrade/reference/gajs-analyticsjs#cross-domain
, A B, Google Analytics " " "", A.
FORM/POST , Classic Analytics. - ? .
, .
.