How To Block WordPress Referral Spam

What Is Referral Spam?

It’s when someone purposely sends fake traffic to another website in order to show up in Google Analytics Referral Traffic reports. The goal is to get webmasters see it in their referral traffic and visit the spammer’s website. This is particularly problematic when decisions are being based off of analytics metrics that are littered with pseudo information. This is why it’s important to block referral spam traffic and keep your website’s analytics data as clean as possible!

How To Cleanup Google Analytics Data

1. Make a copy of your Google Analytics View

Copy Unfiltered Google Analytics View

Label the copy of your primary Google Analytics View “Filtered”.

2. Enable Bot Filtering in your new Filtered Google Analytics View

In your new Filtered View go to View Settings and check the following checkbox to enable Bot Filtering and save your changes:

Enable Bot Filtering Google Analytics

3. Filter out your IP Address

Filter Home IP Address Google Analytics

In your new Filtered View go to Filters and create a new filter set to exclude traffic from the IP addresses that are equal to and enter your home IP address. Just go to to figure out what your IP address is from the corresponding location, enter it and save the filter. Add another one for your work IP address too if relevant.

4. Identify All Valid Hostnames and Filter Out The Rest

By this point, you’ve eliminated the vast majority of all referral spam hitting your site. But if you’d like to take it even further, you can also identify all your valid hostnames and create a filter that excludes all the non-valid ones. To learn how you can check out Carlos Escalera’s detailed guide on the Moz Blog: Stop Ghost Spam in Google Analytics with One Filter.

For this blog the filter is this simple:

Filter out non-valid hostnames in Google Analytics

Something To Add?

Do you know of a better way to deal with referral spam traffic on a WordPress website? Anything else to say? Say your piece in the comments!


  1. I always wonder how i can get traffic from all these website, After reading this post, I realized that its nothing but spam. Thanks for sharing. I appreciate your effort.


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.