0

Google Analytics say one of my pages has 200~ views, another price comparator say 600~ views and i see from log access from nginx, the requests was 24 views.

I use:

cat * | grep -c "http://www.mydomain/my-page.html?utm_source=buscape&utm_medium=cpc&utm_campaign=99999999" nginx_access.log

to get number of request by this url.

The question is, nginx save in log ALL REQUESTS? It's possible nginx isnt registering some requests of this url?

P.S: I use varnish cache

0

Update because you are using varnish, nginx will neither see nor respond to all of your requests, so nginx will not have an accurate count of the number of page views. In this case, I typically trust GA to have a reasonably good measure of your traffic. If you would like to use nginx to verify which of your analytics frameworks has a more correct answer, you should turn off varnish. Varnish typically doesn’t have logging to a file since it would impact performance (it logs to a shared memory segment). But, if you do want to set up varnish logging to a file, you would want to use something like varnishcsa.


nginx will log all requests that nginx responds to in the access log so long as you have configured it correctly. Other factors such as logrotate may affect whether all entries show up in your access.log file. In addition, pre-nginx caching (through something like cloudflare or varnish) may affect whether or not the request is responded to by nginx.

  • Yes...varnish cache. – user2925795 Jan 3 '17 at 20:03
1

Web servers such as Nginx log each request. Analytics software that is embedded into a web page relies on the visitor's browser to run the associated javascript unless disabled then load the usual 1 pixel tracking image often found between <noscript> tags. If the browser has privacy extensions such as uBlock Origin installed then analytics may be blocked from loading. Google Analytics can only see what the browser has allowed it to see. Your web server sees all incoming requests regardless of browser settings.

Just reread the question and as noted by 2ps if your web server has a caching layer in front of it then it will not see those requests.

  • I'm using Varnish cache. – user2925795 Jan 3 '17 at 20:03

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.