Stattraq Karma
Spam is a pain in the arse for everyone, but weblog owners are doubly cursed, since they have to deal with comment spam (spaminomyces conluquii) trackback spam (spaminomyces vestigii) and referrer spam (spaminomyces commendaticius) as well as the common email or “garden” spam, (spaminomyces odiosus) that most people have to put up with.
Thanks to the wonderful Spam Karma plugin for Wordpress, comment and trackback spam haven’t been a problem for me for a couple of weeks, even with it set to “very lenient”. Now I’ve got Referrer Karma installed, with a couple of tiny tweaks to prevent irritating spam links showing up in my StatTraq referral logs. If you get asked to do slightly strange things like copy and submit a code after commenting, or click through an extra link to get here, that’s why. Sorry for any inconvenience.
The tweaks I’ve made to guard StatTraq from referral spam are detailed below, in case they’re useful to anyone:
Installing Referrer Karma as instructed in the readme should in theory prevent referrer spammers even accessing the blog, except if it cannot load the referring page it assumes that it’s OK. This might leave annoying entries in the StatTraq logs if you don’t make the following adjustments.
Disclaimer: I know next to nothing about PHP, but these changes are really very simple and seem to work fine. Perhaps someone with a clue will find a more elegant way to do it. If so please let me know! The author takes no responsibility for loss of life etc…
Install RK as instructed in the here. If you also have SK then make the changes to the settings file to allow it to share the banned IP list; if not, no matter. Assuming you put the files directly into “wp-content” folder, you’ll be told to paste the following code at the very top of your index.php file
< ?php include_once ("*YOUR DOMAIN*/wp-content/referrer-karma.php"); check_referrer(); ?>
Put this instead:
< ?php include_once ("./wp-content/referrer-karma.php");
if (check_referrer()) {
$referrer_is_ok = TRUE ;
}; ?>
OK. Now you need to edit stattraq.php in your plugins folder to prevent it from logging potential referral spam. Find the following:
if (!strstr($urlRequested, 'wp-admin') && !strstr($urlRequested, 'wp-stattraq') && !strstr($urlRequested, 'favicon.ico')) {
Replace with:
if (!strstr($urlRequested, 'wp-admin') && !strstr($urlRequested, 'wp-stattraq') && !strstr($urlRequested, 'favicon.ico') && $GLOBALS[referrer_is_ok]) {
And that should be all. If, as I do, you have a static IP address that you want to prevent from showing up in your logs, you can add
&& $ipAddress != "YOUR IP ADDRESS"
straight after $referrer_is_ok and before the closed bracket.