I run this web site as a hobby but I still like to have tools to check how the site is doing. Slimstat is a tool that I use because it captures things like search strings, referers, etc. It’s like Google analytics but more local.
For WordPress there is a useful plugin that adds Slimstat to the dashboard. My advice to people is to use the plugin as it is fire and forget.
I don’t listen to my own advice 🙂 so I prefer to add Slimstat outside of WordPress by adding a few lines to the wp-config.php like so:
// Jan added Slimstat $ip_jan=$_SERVER['REMOTE_ADDR']; $url_ref=@$_SERVER['HTTP_REFERER']; if (($ip_jan != "24.46.186.255" ) or ($ip_jan != "64.233.178.136")) { if (!(preg_match("/translate.google.com/",$url_ref))) { @include_once( "/srv/www/slimstat/inc.stats.php" ); } } /* That's all, stop editing! Happy blogging. */
I am not a programmer and my PHP is horrible. I add the code to wp-config.php because it gets included every time and I don’t have to modify the theme. Putting it there also means when I upgrade the theme or WordPress version it will get preserved from being overwritten.
I put the if statements in there because I want to exclude from logging website requests from a Google address and from my own IP address. I use Angsuman’s translator plugin and exclude anything that is refered from translator.google.com. If someone hits a web page with /post-slug/es/ (for the spanish version) then I want to see that URL and not the ones that the machine translator hit.
Setting up Slimstat is easy as pie. I put the slimstat on a HTTPS portion of my web page, used .htaccess to password protect the URL (for no real reason other than I can) and I get easy stats available to me without logging into WordPress.