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.
Brian says:
Thanks jan… I’m a horrible programmer as well and i needed to know just where to put a bit of code to get slimstat to work.
July 5, 2009 — 4:24 am
Mika "Ipstenu" Epstein says:
I do similarly but I put it in my ipstenu.php file in mu-plugins
That lets me fire things for ALL sites on my network, and keeps my wp-config simpler (which is less to remember if I get hacked).
February 12, 2012 — 11:53 am
Jan Dembowski says:
That’s definitely a good way to do it and get all the sites stats on one mu-plugin.
Hrm, I may reconsider using Slimstats. I stopped using it a few years ago when I got a free Clicky account but miss getting stats on the other blogs here.
February 12, 2012 — 12:17 pm