1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Google Analytics code different?

Discussion in 'XenForo Questions and Support' started by RobParker, Apr 12, 2012.

  1. RobParker

    RobParker Well-Known Member

    I've added my GA account via my ACP and it's tracking but the code that's automatically inserted is different to the one to be manually inserted from my GA admin page.

    XF automatically inserts:
    Code:
    <script>
       var _gaq = [['_setAccount', 'UA-XXXXXX-1'], ['_trackPageview']];
      !function(d, t)
      {
      var g = d.createElement(t),
      s = d.getElementsByTagName(t)[0];  g.async = true;
      g.src = ('https:' == d.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
      s.parentNode.insertBefore(g, s);
      }
      (document, 'script');
       </script>
    
    
    Whereas the code that GA says to insert is:

    Code:
    <script type="text/javascript">
    
     var _gaq = _gaq || [];
     _gaq.push(['_setAccount', 'UA-XXXXXX-1']);
     _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>
    
    Is this difference significant at all?
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Not significant.
     
    RobParker likes this.
  3. Andy.N

    Andy.N Well-Known Member

  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You can edit the template directly:

    Admin CP -> Appearance -> Templates -> google_analytics
     

Share This Page