Mobile app version of vmapp.org
Login or Join
Lengel546

: Multiple Domain Name Tracking Google Analytics I have a website that has multiple domains attached to it. It seems the real time view only shows visits from the site setup in the actual View.

@Lengel546

Posted in: #GoogleAnalytics

I have a website that has multiple domains attached to it. It seems the real time view only shows visits from the site setup in the actual View.

How can I get real time to show hits from all domain names?

Here is the code I am using on all my pages:

<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','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'MY_ANALYTICS_ACCOUNT_HERE', 'auto');
ga('send', 'pageview');

</script>


Do I need to adjust the code to track all domains? Or do I need to adjust a setting in GA itself?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Lengel546

1 Comments

Sorted by latest first Latest Oldest Best

 

@Alves908

First off, are you absolutely sure you want to track all this data in one view? Perhaps keeping the views separate might be a cleaner solution?

Have you check out the Google Analytics resource on Cross-domain tracking (https://support.google.com/analytics/answer/1034342?hl=en) already?

It explains that the initial tracking code should look like this:

ga('create', 'UA-XXXXXXX-Y', 'example-1.com');


And you should add the following code for additional domains:

ga('create', 'UA-XXXXXXX-Y', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['example-2.com'] );


Finally, for three or more domains that would be:

ga('linker:autoLink', ['example-2.com', 'example-3.com'] );

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme