How to Stop Spam Comments on Your Blog
Today I decided to tackle the problem of dealing with spam comments on the blog. The site is so new that it's not a problem yet, but I have done a few blogs in my time and I know the evil that is to come if you don't take action to prevent it.
There are so many options available for stopping robots posting spam on your site, but all of them seem so cumbersome. Many of them do indeed stop spam in its tracks, but they often come with the side effect of inconveniencing the real end-users. So rather than scream at ReCaptcha for not loading correctly via AJAX I decided to try a different method of stopping spam. The method has to work without javascript enabled because this site is my practice project for progressive enhancement. I searched around and found something pretty cool, Akismet.
Akismet is a simple (free for personal use) library that you can use to check comments against the Akismet database. I'm not privy to all the inner-workings on the Akismet server but suffice it to say, I ran some test scenarios and it correctly identified the crazy posts as spam. Quite useful and it all happens behind the scenes.
PROS
- It happens behind the scenes on the server side so the user is not inconvenienced by silly captcha images or having to add 2 + 2 or something similar.
- Third party servers handle the check to see if the comment is spam. All you do is make the call.
- The library contains methods to mark comments as spam in case some makes it through to your site. This method will send the comment to Akismet to be evaluated and if it is indeed spam then it gets added to the spam database.
- Similarly, a method is available to mark as "ham". This is for if a valid comment gets marked as spam. Akismet gets notified and can examine the comment to verify it was not spam and adjust their spam database accordingly.
CONS
- It's not perfect. Some spam occasionally gets through.
- Page load time is slightly longer while the server communicates with Akismet.
- Almost no documentation to help you get started.
I feel like the pros far outweigh the cons, but it is up to you to decide if it is right for your site.