0

Google Analytics confuses me.

I have always had a feeling that the Google Analytics visitor count for my eCommerce website was too low. Today I took a closer look.

Last weekend there were about 8 orders (by different customers) on the website on Saturday and 9 on Sunday. Google Analytics however shows only 3 visitors on both Saturday and Sunday.

The following familiar code snippet is in the main template of the site, which is called on every click.

<script type="text/javascript">
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    try {
        var pageTracker = _gat._getTracker("UA-xxxxxxx-1");
        pageTracker._trackPageview();
    } catch(err) {}
</script>

Yes, I am filtering (excluding) some fixed IP addresses from being counted, but only of my own sites.

I know that visitors that have Javascript disabled cannot be counted, but I do not believe this explains it.

What is going on, is this normal? Does anyone know why more than half of the visitors are not counted?

ronalchn
  • 12,225
  • 10
  • 51
  • 61
Wil
  • 892
  • 1
  • 8
  • 10
  • Surely a question for Google's Analytics team? It's not really a programming question as it's a cut and paste from their system. – Lazarus May 12 '09 at 14:17
  • Perhaps there a problem with the way you're excluding your own sites. – DevinB May 12 '09 at 14:27
  • I have both a StatCounter counter and the Google Analytics widget on my blog and I've noticed this too. StatCounter counts every pageview, but GA dismisses some for some reason. – Yuval May 12 '09 at 14:30

6 Answers6

2

This should be on the top of your content.

<script type="text/javascript">
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>

This should on the bottom of your content:

<script type="text/javascript">
    try {
            var pageTracker = _gat._getTracker("UA-xxxxxxx-1");
            pageTracker._trackPageview();
    } catch(err) {}
</script>

If you have done this, it should work correctly.

Polichism
  • 224
  • 1
  • 7
  • Thanks, but why top and bottom of the content? GA only says "Copy the following code block into every webpage you want to track immediately before the

    tag."

    – Wil May 12 '09 at 14:42
  • I tought it was something about the page isn't ready yet when the script wants to run. – Polichism May 12 '09 at 14:50
1

While reading this StackOverflow quesion I noticed that I had changed the script block:

<script type="text/javascript">
        var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
        document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
        try {
                var pageTracker = _gat._getTracker("UA-xxxxxxx-1");
                pageTracker._trackPageview();
        } catch(err) {}
</script>

Which should be split into two parts, according to Google:

<script type="text/javascript">
        var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
        document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
        try {
                var pageTracker = _gat._getTracker("UA-xxxxxxx-1");
                pageTracker._trackPageview();
        } catch(err) {}
</script>

I have changed it to the recommended format and am awaiting what happens in the next few days.

Community
  • 1
  • 1
Wil
  • 892
  • 1
  • 8
  • 10
0

I have wrote my own visitors counter (together with logging of IP, reoslution, http user agent and other information). The counter was javascript initiated.

I used it on 3 different websites, and after a few months I concluded Google Analytics was slacking off huge chunks (15% to 40%) of the actual visitor numbers.

Maybe it has something to do with addblock browser plugins?

oxygen
  • 5,891
  • 6
  • 37
  • 69
0

I am using Google Analytics for many of my sites and so far have not faced this issue.You can check with the google support page here. Also have you checked whether your site is configured to use the correct Time Zone?

Shoban
  • 22,920
  • 8
  • 63
  • 107
0

I know that visitors that have Javascript disabled cannot be counted, but I do not believe this explains it.

Have you looked at your server's access logs? Marry them up with Google Analytics, see which visitors weren't being counted?

Paul D. Waite
  • 96,640
  • 56
  • 199
  • 270
0

You can set up another profile to gather unfiltered data and compare the reports to the filtered profile.

Liam
  • 19,819
  • 24
  • 83
  • 123