Software

Adding Slimstat to WordPress

Slimstat thumbI 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.

Standard

6 thoughts on “Adding Slimstat to WordPress

  1. Pingback: SlimStat: Stats Tracking For Your Self-Hosted Wordpress Blog : Secrets To Web Success : Internet Marketing and Consulting

  2. Pingback: SlimStat: Stats Tracking For Your Self-Hosted Wordpress Blog : Online Marketing Tips and Resources

    • 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.

  3. Pingback: Old content! Now in 3D! - Mostly Harmless

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>