4

I got a website which will track all the post's visitor view and store each of them in a table with IP address, referrer website and user agent. But I found that in one day I got 100+ rows (pageviews) in my database table, but Google Analytics showed that it has only around 40 pageviews that day.

Besides, when I found out my database got a new row and I went to see the Real-Time report in Google Analytics, it shows that my website got 0 visitors in the past 30 minutes.

I did tried accessed my website using my own phone and computer, both database and Google Analytics will record my view, anyone know why?

  • Your program might not be ignoring bot traffic while google analytics does ignore some bot traffic (specifically google bots). There is an option of ignoring other bot traffic in analytics - see if that is enabled. – Aakash May 29 '16 at 17:07
  • 1
    "...both database and Google Analytics will record my view, anyone know why?" - presumably both your database and GA are not recording your view? (GA will always be less than your server stats since it runs in the client and is reliant on JS.) – MrWhite May 29 '16 at 17:47
  • @Aakash nope they are not bot traffic, as the user agent showing that they are mostly Android devices, and the referer website was Facebook, so I guess people share my website link in Facebook. – Ping May 30 '16 at 1:53
  • @w3dk Yea I thought that too, so I tried to implement a pop up and once they close the popup I will send a custom event to GA, but still nothing was recorded. – Ping May 30 '16 at 1:55
4

There are a number of reasons why Google Analytics may not be showing the traffic your database shows...

Your Code Is Positioned Poorly

Your GA tracking code should be in the head section of the document, some webmasters put it in the bottom to improve load times however this can sometimes mean that the user has come to your site and then bounced right back out before GA has finished loading. (https://support.google.com/analytics/answer/1008080)

User Has Javascript Disabled

GA depends on javascript to run. Some users have javascript switched off in their browsers for security reasons. Most web crawlers don't process javascript either and so a crawler won't show up in GA while your server logs and database log will show the traffic from the crawler.

User Has Opted Out of Analytics

Google provides a browser add-on to opt out of Google Analytics. When this add-on is detected GA will not log any details about the browser and as far as your GA report the user never connected. (https://support.google.com/analytics/answer/181881?hl=en)

High Volume

In some instances where GA data is consistently off base with your own analytics it can indicate that Google has decided to start sampling your data instead of showing all of your data. This is generally due to a high amount of traffic but I have been unable to find any details on the Google support page (https://support.google.com/analytics/answer/2637192?hl=en) about what sort of traffic limits there are before sampling comes into place. The only way to avoid this is to use another analytics provider as it is forced into GA free to limit excessive loads on the GA network.

As you can see there are a number of reasons why Google Analytics will not show all the records your database or server analytics do and these aren't all the reasons, just the most common. You will probably find that the large discrepancy is to do with multiple issues some of which will be in this list. As a side note the only one of these issues that can be fixed is the code position, the other issues can't be fixed.

  • Just an addition: one of the main tracking bugs is that onclick tracking events are implemented without ga hitcallbacks. – Jurik May 30 '16 at 9:44

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.