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

XF 1.5 google analytics not Work

Discussion in 'XenForo Questions and Support' started by takshing2001_hk, Oct 29, 2015.

  1. takshing2001_hk

    takshing2001_hk New Member

    my google analytics code
    Code:
    <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-123456-7', 'auto');
      ga('send', 'pageview');
    
    </script>
    my site layout
    Code:
        <script>
    
    <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-123456-7', 'auto');
      ga('send', 'pageview');
    
    </script>
    
    google_analytics Templates code
    Code:
    
    <xen:if is="{$xenOptions.googleAnalyticsWebPropertyId}"><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', '{$xenOptions.googleAnalyticsWebPropertyId}', 'auto');
    
      ga('send', 'pageview');
    
    
    </script></xen:if>
    
    
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    How are you entering your GA code?

    You just enter it in the ACP -> Options -> Google Integration -> Google Analytics Web Property ID
     
  3. takshing2001_hk

    takshing2001_hk New Member

  4. Mike

    Mike XenForo Developer Staff Member

    Looking at your site, I can see the GA code in the source.
     
  5. takshing2001_hk

    takshing2001_hk New Member

    But the Google still show

    Tracking ID
    UA-69464498-1
    Status: Tracking Not Installed
    Last checked: Oct 29, 2015 4:59:41 PM PDT
    The Google Analytics tracking code has not been detected on your website's home page. For Analytics to function, you or your web administrator must add the code to each page of your website.
    Learn more
     
  6. Mike

    Mike XenForo Developer Staff Member

    GA may not be picking it up because your board is closed (temporarily unavailable). It should still start reporting soon.
     
  7. torquewrench

    torquewrench New Member

    I'm running into this same snag. I actually installed Wordpress on the front end to install it through a Wordpress plugin (Xenforo still runs and appears through /forum). What's interesting is real time will show active users, but it's not recording their activity.
     
  8. torquewrench

    torquewrench New Member

    Would I be better off just adding the script to the footer template?
     
  9. Mark T

    Mark T Member

    Google recommends you use the asynchronous tracking code. This should always be located in the <head> section.

    XF pushes it there, but if you use the Defer JS modification, this is then pushed to below the </head>.

    Then your webmaster tools will no longer recognise your property verification.
     

Share This Page