Dan Davies{ Front-end Developer }

Removing spam from Google analytics and your website

23rd May 2015

If like me, you check your Analytics a lot and see stuff like best-seo-offer.com and semalt.com on there, it get’s a bit annoying when you think how much it is polluting your stats. Granted, it’s only a personal site in my case but I’ve seen it with clients. So how do you stop it?

Within Google Analytics

First off, you can filter in Google Analytics. It’s quite straightforward and can be found under the Admin tab and then Filters.

filters

filters2

filters3

You have now added filters. Huzzah!

I have also found that there is a tick box under View Settings in Analytics to block spam bots and spiders. As yet, I’m not sure if that does anything yet but who knows, it’s there for a reason I guess. You can read more about it.

In your htaccess file

Also, you can block these sites from visiting your website via your htaccess file. Bear in mind, you may not have one depending on your site setup so I would google about htaccess if you are unsure. I’m using WordPress so I have access to one.

Anyway after much research, I found a helpful chap called Stevie Ray who has compiled a list of all the known spammers and creates a htaccess file snippet which he keeps updated with the latest spam bits included and that can be found on here.

Basically add that to your htaccess file and you should be good to go.

I’ve only recently done this and as yet, can’t confirm or deny if it’s helped but I will report back.

Back to top