I am currently working on a WordPress website, having installed Google Analytics. GA is running well, but especially with regard Facebook traffic, it shows completely other figures. After publishing a "viral video" post on Facebook (and adding a call to action “more” linking to our website), WP Statistics reports many visits, while GA captures only a very incremental increase. We started to use UTM codes but this did not led to any chances.

I my opinion the error has to do something with the In-App browser of Facebook. If people click on a video, the video runs in the upper 1/3 of the screen and in the lower 2/3 the website is loaded/displayed. Is a potential reason that Facebook caches the website to deliver it faster to the users? Consequently, GA cannot capture this traffic? But why is WP Statistics able to do so?

I would love to find out more!

Stats of WP Statistics

  • Since WP statistics is a server-side script, it's always going to count more that GA, which relies on JS being processed by the user-agent.
    – DocRoot
    Commented Aug 24, 2017 at 17:20

2 Answers 2


Back in the day when I used Google Analytics (GA), I had to use javascript code it gave me and embed it into my website in order for GA to track number of visits.

The biggest reason why the difference in numbers can be way off between counting visitors directly on your server and counting visitors through GA is because some guests (or more likely some robots) are accessing the webpage without processing Javascript. When the Javascript doesn't get processed, tools like GA will not record the count. Its highly possible that your server is adding to its count when the server script is called.

A simple PHP script like this can record the count of everything that visits your server from robots to humans:

    //rest of page processing goes here

I might have gotten the parameters in the wrong spots for file_put contents, but what this program does is read counter.txt which stores the number of accesses to your script (which also loads the webpage) then it increments the count and then it updates counter.txt with the new count.

If you still want to use GA for counting, then consider putting its javascript before any other javascript and the accuracy might somewhat improve since then GA must load first.


Yes , Definitely robots are being recorded in the higher count Analytics, with GA I had to install the robots.txt file which would direct the google robots to such n such file in a web search, with WP possible this could not be counted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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