Ukuser32
Ukuser32

Reputation: 2189

Multiple Google analytics on same page

How do you setup the current analytics.js to send results to multiple Google accounts? These are different UserIDs.

<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-XXXXXX-46', 'auto');
    ga('send', 'pageview');

    ga('create', 'UA-YYYYYY-16', 'auto');
    ga('send', 'pageview');  

</script>

For some reason when I install Chromes Google Tag Assistant I get "No HTTP response detected" however their advice isn't particularly helpful on what that means. I have seen Google Analytics "No HTTP response detected" while tracking multiple accounts and using linker and the link but this doesn't apply to a basic example like mine.

Upvotes: 1

Views: 5271

Answers (1)

Ukuser32
Ukuser32

Reputation: 2189

For anyone looking into this - a much better link is https://developers.google.com/analytics/devguides/collection/analyticsjs/creating-trackers#working_with_multiple_trackers. This helps.

Upvotes: 4

Related Questions