it's quite a long time Analytics is making me crazy: I have a 2 years old website, started with Aruba (an Italian provider) and then transfered on Hostgator. It's a blog Wordpress + MyBB forum, and on both the platforms I've the Analytics code in the footer. The problem is that the stats on Analytics are simply ridiculous compared to the numbers reported by the Aruba (before) and Hostgator (then). I think that the numbers of Aruba/Hostgator are correct, simply because just the daily users connected on the forum is higher than the Analytics numbers. I know it's a really confused request, but maybe you can help me to understand what's the problem.

migrated from serverfault.com Jun 28 '11 at 13:45

This question came from our site for system and network administrators.

  • 1
    You'll always get a difference between Analytics which uses Javascript and so counts real people, and host based stats, which includes search engine bots. How are you getting the "daily users connected" figure? – paulmorriss Jun 28 '11 at 13:47
  • It might help if you posted the analytics code that you're using. – JMC Jun 28 '11 at 14:10

Google Analytics requires Javascript, so people and bots which do not execute Javascript will not be counted.

Also you should get the new Analytics code which goes in the head rather than the end of the body like the old one. When you generate that code, make sure to select the domains and subdomain option if your site accepts yoursite.com and www.yoursite.com as URLs. Having the analytics code in the header, particularly for a heavy site will remove the chance of users who stop the browser or lose the connection before downloading the whole page.


Since you mentioned that your code is in the footer, do you have the entire code block in the footer? If so try putting the top half in head:

This code is just an example to show where the break should occur. Your code might look different.

<script type="text/javascript">
//Tracking code customizations only
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'your analytics acct #']);
      _gaq.push(['_setAllowHash', false]);

Only include the part starting with (function(){ in the footer with script tags around it:

    (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);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy