What are the implications of having two Google Analytics tracking codes on 1 site?

38,662

Solution 1

Google allows Multiple tracking codes on web pages. However, some configs may not be supported.

You can install multiple instances of the Google Analytics tracking code on your web pages to send data to multiple properties in your account.

Not all configurations are supported. You can, for example, install multiple instances of the Universal Analytics tracking code (analytics.js) on your web pages but only one instance of the Classic Analytics code (ga.js). Multiple instances of ga.js might result in inaccurate data collection, processing, or reporting. You can, however, install one or more instances of analytics.js on web pages that also have a single instance of ga.js.

Using multiple tracking codes might be useful if users with access to different properties need to see data from the same website, or if you have multiple versions of a website. You might, for example, want to collect data from example.com using one instance of analytics.js, collect data from example.co.uk in another instance of analytics.js, and use a third instance of analytics.js on both websites to see the aggregate data.

Using Multiple Tracking Objects you can combine multiple Google Analytics ID's and accounts, this is useful for multiple site owners overseeing all of parts of the website. This can be done by editing the JavaScript see the example below:

ga('create', 'UA-XXXX-Y', 'auto');
ga('create', 'UA-12345-6', 'auto', 'newTracker');  // New tracker.

Solution 2

There will be no implications, but I suggest that instead you create a separate view on one analytics and give access to whomever you need to give, if that is the reason. Also, if tracking is important to you (which looks like it is), I encourage you to use Google Tag Manager in order to add some events, since with this set-up you will get a lot of info, but that info might be misleading. GA (without configuration and events and other stuff) will collect data that might look ... (not true) to you. With GTM you will get more control over your tracking code, you will not mess up your code, you will have less JavaScript on your site, and most importantly you will get more accurate data in your GA account.

Share:
38,662

Related videos on Youtube

runners3431
Author by

runners3431

Updated on September 18, 2022

Comments

  • runners3431
    runners3431 over 1 year

    What are the implications of having two tracking codes on 1 site? Both codes will be right under neath one another

    e.g.

    <script type="text/javascript">// <![CDATA[
    var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-account-1']);
      _gaq.push(['_setDomainName', 'mydomain']);
      _gaq.push(['_trackPageview']);
    
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
    // ]]></script>
    

    and

    <script type="text/javascript">// <![CDATA[
    var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-account-2']);
      _gaq.push(['_setDomainName', 'mydomain']);
      _gaq.push(['_trackPageview']);
    
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
    // ]]></script>