I recently switched my logging from an external tool to a tool hosted on my server called Piwik. Piwik is a fantastic free tool designed to help perform some simple analytics (and possibly even complicated analytics) on visiting users.
For the last few weeks, however, I have found that I was getting 0 tracking, no visits. And while most of the projects it’s up to are somewhat stale, it did not even track when I visited! And what’s an engineer to do when something he expects to be working isn’t? Debugging!
90% of my problems have been caused by bad configurations (which I set) — so I figured this might be one and the same. Here are some steps to help you (found after minutes of googling) debug your piwik config. NOTE, I’m using piwik behind nginx (so using php-fpm).
- Enable Debugging on the Piwik tracker(http://developer.piwik.org/api-reference/tracking-api#debugging-the-tracker)
Basically, go into piwik.php and search for “debug” (case insensitive), turn on the debugger)
- Open/tail -f your apache access and error logs
mine are in /var/log/nginx/access.log & /var/log/nginx/error.log respectively — you’re going to want to see what nginx is doing with your requests
- Turn on error reporting in php & php-fpm config & other places that might be stopping error messages from escaping
I turned on: “display_errors” in /etc/php5/fpm/php.ini
- Make sure to turn off Do Not Track if your browser supports it! Piwik will honor that setting by default and not track your visitors.
*\* REMEMBER TO RESET RELEVANT SETTINGS ONCE DEBUG TIME IS OVER **
Also, if you’re interested in seeing how many visitors you’re getting at the NGINX level, use goaccess, it’s pretty awesome.
After a small adventure, it looks like the tracking is working as intended. Now, to get more visitors!