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

Google analytics does not work

Discussion in 'Troubleshooting and Problems' started by silendreamer, Oct 24, 2010.

  1. silendreamer

    silendreamer Active Member

    I input my google analytics code in the text box in Statistics and Metrics.

    When I login to google.com/analytics and try to verify my website, it gives me error

    Code:
    Tracking Not Installed (Last checked: Oct 24, 2010 7:05:09 AM )
    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.
    
    It is asking me to put in the following code
    Code:
    <script type="text/javascript">
    
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-4196716-16']);
      _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>
    
    When I check my page source the following code is present
    Code:
    <script type="text/javascript"> 
    	<!--
    	var _gaq = [['_setAccount', 'UA-4196716-16'], ['_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> 
    

    The code that google analytics is asking me to put is not the same as the one that Xenforo is putting in my webpages.

    Is this a bug? Any suggestions on what I should do? I am going to modify my footer template and add the code in there.
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    1) When you verify your site with Google be sure to enter the URL of your forum.

    2) Try reverting these templates if they are customized:

    Admin CP -> Appearance -> Templates
    > PAGE_CONTAINER
    > google_analytics
     
  3. steven s

    steven s Well-Known Member

    Analytics is picking up my site, so I assume it's not a bug.
    I have similar code on my page.
    Is your site viewable to the public?
     
  4. Floris

    Floris Guest

    I've went to my analytics account and created 2 new ones when I moved 2 sites over to xenforo

    1 was vb import to xenforo
    1 was fresh install

    both got unique codes, and the first one has stats, the second one didn't.

    I've set up 2 more profiles and added the code to two more sites of friends of mine, and we will see in a week how it goes.
     
  5. yoghurtfarmer

    yoghurtfarmer Well-Known Member

    I believe xenforo's code is based on further optimization of google's code based on this: http://mathiasbynens.be/notes/async-analytics-snippet

    If it doesn't work, go into the google_adsense template and replace it with the code that google provides, subbing in the variable of course. No need to add it in the footer.
     
  6. Floris

    Floris Guest

    It should work out of the box :)
     

Share This Page