How To Block / Referral Spam in Google Analytics

This page is dedicated to blocking in Google Analytics. There are many who wonder what is We will explain this to you in the following few paragraphs.

This is something classified as referral spam by online experts, a practice that, sadly, not enough webmasters are acquainted with. In this instance the / Referral Spam is aimed at your website personally in order to achieve one specific goal: to bring down your credence in the eyes of Google. In a short description, it connects with you with different IPs, get in, and leaves immediately to reduce the time users spend on your pages and to increase the bounce rate – two extremely important metrics.

How To Block / Referral Spam in Google Analytics

The websites

The / Referral Spam and its pages have absolutely no relation to your website. They are not a sound business activity that linked to you, or anything. They exist as a tool created by some of your competitors in order to counteract the efforts you spend at actually improving your content and engaging your readers. If left untended the / Referral Spam can quickly negatively impact your statistics’ quality, as it features a 100% bounce rate and likely 0 second sessions. All of this is done through the use of so-called Web Crawlers – bots that visit your website and leave their signature (thus showing it later in your analytics; the reason we have people asking what is At the beginning these bots were created by search engines to index the sites they visit, the normal practice still used today. However over time this has been misued (and all-around abused) in what is called Crawler Spam.

Do NOT use the Referrals Exclusion List to block!

More than likely this has crossed your mind if you don’t exactly know what the exclusion list does. It will not solve your problem, but rather make it worse in reality. If you use the list to block the / Referral Spam, the referrals will disappear from the statistics, but appear in the viewership of your website, thus practically muddling the waters even worse. Referrals are always counted on the side from normal traffic. Blocking it there just block your statistics – it does not impede in any way the website from connecting to you.

Block / Referral Spam in Google Analytics

Things readers are interested in:

STEP 1: In your Analytics account go to Admin —> All Filters.

How To Block / Referral Spam in Google Analytics

STEP 2: Next, click New Filter and add in the Filter Name value.

STEP 3. Select the Custom Filter Type.  In the Filter Field —> Campaign Source. In the Filter Pattern text box, add and click the Save button at the bottom of the webpage.

How To Block / Referral Spam in Google Analytics

 Blocking referrer spam through .htaccess

If you know how to access your .htaccess file, you just need to input the following code in there:

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

If you don’t know how to access it, do the following:

Login to your cPanel account —> File Manager —> click the check-box “Document Root for—> your website. A side note: click on “Show hidden Files” and then Go. Find the .htacess file, right click it and choose Code Edit. Input the code I gave you and Save Changes. 

Did we help you? A thank you in the comments goes a long way to warm our hearts!


About the author


Nathan Bookshire


  • Hello,

    Yes, for best results you should do both. As for your other question, could you clarify a bit? Which code do you mean to translate into .js? The one that blocks the spam though .htaccess?

  • Hello Kiley,

    Did you try the custom filter solution already? Also try contacting Flywheel and ask them what kind of solution are they recommending so we can relate to other people that use this host. Please let me know when you have a response.

  • Hi Gerardo,

    Other sites access to your page will not be affected regardless of how many of these spammers you block. As far as Google knows these are regular sites, when enough people are affected Google will block them.

    It is recommended that you do both, but sometimes using just one of these can be enough. Please let me know if you use one or the other method and it works for this specific wave so I can recommend the same to other people.

Leave a Comment