How To Remove Referral Spam

  • sharebutton to referral spam filter

Yet another social share button website called has been spamming everyone’s Google Analytics data. This spam only affects your Google Analytics data and not your actual website, although if you’re like me and you use your Google Analytics data to make changes to your website, then blocking out ghost referrer spam is a must.

How To Block Spam: Filter Method

I created the instructions below using both images and text to make it easier for you to understand and follow the guide. The important parts of the page that you need to click or interact with are marked with a red circle.

1. Go To The Google Analytics Website And Log Into Your Account

Google Analytics Login Screen

You can visit the website by clicking the URL in the heading or by clicking here.

2. Go To Your “Admin” Tab

Google Analytics Admin Tab

The admin tab is right next to the ‘Customisation’ tab to the far right of the Google Analytics logo.

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

Google Analytics Filters

Once you’re on the admin page, go to the 3rd column called “View” and click on “Filters”.

4. Click On “+New Filter”

Google Analytics Add New Filter


There’s a big red button on the page that says “+New Filter”. It’s pretty hard to miss, so click it.

5. Enter The Information In The Image Below And Save

sharebutton to referral spam filter

This is the final and longest step in this guide. Once you’re on the filters page. You’re going to want to do the following:

  1. Click on ‘Create New Filter
  2. Under ‘Filter Information‘, click on ‘Custom
  3. Click the “Exclude‘ button
  4. Under ‘Filter Field‘, select ‘Campaign Source‘ from the drop-down list.
  5. Under Filter Pattern, enter ‘
  6. Click on ‘Save‘.

Wait about an hour for the filter changes to take effect and you should be able to see your real Google Analytics data without the referrer spam in it.

How To Block Spam: Htaccess Method

In every article I’ve written about ghost referrer spam, I never recommended using this method or the following method if the referrer spam is indeed ghost referrer spam that never actually visits your site as this method and the subsequent method are more suited for protecting your site from any possible sessions in the future from these sources. If you find that the traffic is taking up your server resources or you think that it may be malicious, then try using thie following code in your htaccess.

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

How To Block Spam: Deflecting Method

This is not also 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 Sharebutton Referrer Spam Occur?

The website consists of 2 boxes that allow you to copy and paste the code in the boxes into your website, so this was clearly the objective of the website’s referral spamming campaigns.  I did not test whether or not this code was malicious, although it’s best to assume that a website engaging is suspicious marketing campaigns probably isn’t the best one to use codes from.


Alistair Kavalt