1

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?

1

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'] );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.