I've been reading up on how to filter out spam from Google Analytics. In this case, I'm trying to filter out the spam that shows up under referrals.

In the Filter Pattern field of Analytics, I have the following:


Yet it makes no difference to my Analytics. I've also clicked the verify link but all I get back is:

This filter would not have changed your data. Either the filter configuration is incorrect, or the set of sampled data is too small.

Am I doing something wrong?


2 Answers 2


Are you filtering by campaign source? Also, are those all of the spam domains that you're seeing in your referral traffic? Most of the regex I've seen for this is considerably longer and more inclusive.

Don't forget to include a hostname filter as well to help with ghost spam. I also recommend filtering out your internal IPs for good measure.

  • ah thank you, setting it to campaign source and now it appears to be working! I read on a couple of guides that you should have it set to 'referral' though?
    – user47053
    Commented Oct 10, 2016 at 9:00
  • ...also no that's not all the spam domains I was seeing, but just wanted to check I was doing it properly first. I'll go ahead and add the rest now :)
    – user47053
    Commented Oct 10, 2016 at 9:01
  • oh hang on a minute actually, it seems to work when 'verifying' the data, but then when I actually view my analytics again it still seems to be tracking visits from the spam domains?
    – user47053
    Commented Oct 10, 2016 at 9:04
  • 1
    You might need to give it a while; the filter won't work retroactively so you won't see changes to historical data. It will only affect future data.
    – Gesundheit
    Commented Oct 10, 2016 at 13:35
  • 1
    Of course! One more thing, just in case: be sure to have a view set up in GA that has no filters as well, just in case you ever for any reason find a problem with your existing filters. Trust me, a day will come when you'll be so relieved that you have. Cheers!
    – Gesundheit
    Commented Oct 13, 2016 at 13:35

Myself, I have been completely blocking domains, IP ranges and even whole countries right in my .htaccess file. For instance:

Domain Referrers

# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} ranksonic.com [NC]
RewriteCond %{HTTP_REFERER} emailmarketingrobot.com [NC]
RewriteCond %{HTTP_REFERER} monetizationking.net [NC]
RewriteCond %{HTTP_REFERER} compliance-checker.info [NC]
RewriteCond %{HTTP_REFERER} semalt.com [NC,OR]
RewriteCond %{HTTP_REFERER} 1-99seo.com [NC,OR]
RewriteCond %{HTTP_REFERER} seoanalyses.com [NC]
RewriteRule .* - [F]

IP Ranges

# Deny from     ( -


<Files *>
order deny,allow
# Russia (RU), Ukraine (UA), Belarus (BY), Bulgaria (BG), Czech Republic(CZ), Romania (RO), Latvia (LV), Estonia (EE), Kazakstan (KZ), Moldavia/Moldova (MD), Poland (PL), Serbia (RS), Siberia, Slovakia (SK), Slovenia (SL)
# deny from

It's amazing how much your bounce rate goes down when you block all of your spammy referrers and hacking attempts from all of the notorious hacker countries...

  • I'm not exactly sure what you mean by "campaign source"... When I notice that i'm getting a lot of referrals in Analytics from a given domain, I will visit the site and 9 out of 10 times I will find that it is some sort website that is sending out bots out to scrape whatever data off of my site. All of the IP addresses are discovered by viewing my web logs and finding IP addresses that are viewing tons of pages and pulling up tons of 404's. Then I will run the IP's and most of the time they end up being from Russia and China. Obvious hacking attempts... Commented Oct 3, 2016 at 11:08