Get Rid of Referral Spam

  • referral filter referral usually comes along with referral spam as the 2 are most likely related in some way (considering how similar the URLs and the current state of the sites are, it’s hard not to assume this). Because of this, I’ve created this article to show you how you can get rid of this ghost referrer spam.

How To Block Spam: Filter Method

The easiest way (and the way I always filter out this type of referrer spam) to filter out referrer traffic is to simply follow the instructions below:

1. Log Into Your Google Analytics Account

Google Analytics Login Screen


2. Go To Your “Admin” Tab

Google Analytics Admin Tab


3. Click On “Filters” Under The “View” Section

Google Analytics Filters



4. Click On “+New Filter”

Google Analytics Add New Filter

5. Enter The Information In The Image Below And Save referral filter

How To Block Spam: Htaccess Method

Unless the spam traffic actually visits your site, then I see no reason for actually doing using this method.

RewriteCond %{HTTP_REFERER} [NC,OR] RewriteRule .* – [F]

How To Block Spam: Deflecting Method

Again, not a recommended method, but you can create a text file called “” and add the following code to it:

##referer –> redirect target

After that, you’re going to want to add the following code to your .htaccess

RewriteMap deflector txt:/path/to/
RewriteCond %{HTTP_REFERER} !=””
RewriteCond ${deflector:%{HTTP_REFERER}} =-
RewriteRule ^ %{HTTP_REFERER} [R,L]

Why Does Social-Buttons Referrer Spam Occur?

Similarly to, no longer exists. Since there’s no cached version of the site, I’m going to make the same assumption I did last time and say that referral spam was used to attract visitors who saw the URL in their Google Analytics data to a website that sold or allowed someone to download possibly malicious social sharing buttons for their site.

Alistair Kavalt