Simple ways to block referrer spam in Google Analytics


· 01st September 2020·Wordpress, Wordpress Security


If your bounce rate is 100% and the duration of the session is 00.00.00, then it very likely it’s referrer spam. It can severely harm your website and distort your analytics report.

Simple ways to block referrer spam in Google Analytics

Have you noticed recently a lot of referral traffic from some shady sites with unusual domains? If your bounce rate is 100% and the duration of the session is 00.00.00, then it very likely it’s referrer spam. It can severely harm your website and distort your analytics report.

Brief intro into Google Analytics

Google Analytics is the most widespread and popular analytics tool on the market. With its help you can track website traffic, as well as get a detailed report of how users interact with your website. you can keep track of your visitors’ location, what they are looking for, etc.

Once that information is available to you, you can build your marketing strategy.

What is referrer spam?

To put it simply, it’s a way to pass fake website hits to your Analytics. You will see in your report referrer spam when a spammer sends multiple requests to your website using all fake URLs. Analytics will then track the fake hits seeing them as valis referral traffic and include them in the reports.

When there is a spam attack, you will notice massive increase in your normal site traffic. You should be aware, they are not from real users, but in fact are created by bots. Sometimes they can even bypass your website and hit the Analytics servers instead. They will also show up as referral traffic in your reports. This spam is called ghost referral spam.

It’s actually quite easy to identify referral spam in your Google Analytics reports. First, locate where your referral traffic is in Analytics. Open your Google Analytics dashboard and go to Acquisition – All Traffic – Referrals.

What is referrer spam?

You will instantly spot the strange domain names. Then check the bounce rate. If it’s 100% and duration of an average session is 00.00.00, those are spammy links.

Why referrer spam can be harmful to your website?

A common purpose of referral spam is SEO. The spammer site will send out the fake URLs to a huge number of websites, and when they are visible in the analytics report, a lot of site owners will click on them. Those click can affect in a positive way the spammer website’s SEO.

In can, however, have negative effects on your site. On some cases, those links have malicious scripts in them, making your site vulnerable to hackers.

It can also affect your business growth, as the referrer spam can affect your Analytics report, preventing you from properly analyzing your situation.

So, let’s take a look at the best ways in which you can block WordPress referrer spam in Google Analytics.

1. Strong Security Software/Tool Referrer spam is simply another spam, which can harm your site, meaning you need to be prepared in cases such as this.

In order to avoid security threads which could potentially harm your WordPress site, you can use a security tool, such as Sucuri.

Strong Security Software/Tool

This powerful firewall and security software can protect your site against Trojans and malicious malware like referrer spam.

It can also detect new referral spammers, adding them to your black list, so that they would not be able to attack your site.

2. Using a plugin Another way is by installing a WP plugin designed to clock out referrer spam. There are plenty of security plugins available, for this example we have chosen Block Referer Spam.

After installing and activating the plugin, Referer Spam will be visible in the dashboard.

Once you hover your mouse over it, you will see two submenus: Referer Spam and All Blocked Sites. When you click on the second option, you will see the list of sites which have been blocked.

Using a plugin

For addition custom settings, click on Referer Spam.

You can choose from there Auto Update or Block Mode. A manual update could be done as well.

Block Mode

If you notice referrer spam links from your Analytics report which are missing from your updated list, add them manually. You simply need to copy the links and paste them in the text area, right next to Custom Blocks. Save your changes.

Custom Blocks

3. Use Google Analytics Filtering to block out referrer spam Even if you use both of the methods above, you might still notice referrer spam in your Analytics report. The reason is, those sites have no contact with your site, which is why these tools can’t block them.

This type of referral spam is called ghost spam. Using the UA tracking code, they will send out request directly to Google Analytics. The code is used to connect your website with your Analytics account. Anyone can locate your code and generate referrer spam with it.

To prevent this, you would need to set up filters in Google Analytics.

Log into your Analytics account and choose the correct site property from the menu at the top of the home page.

site property

Next you will see a popup, giving you the option to choose the site view. By default, you can see All Website Data.

select view

After selecting the correct property and the original view, go on Audience – Technology – Network.

Choose Hostname as the primary dimension and make sure to expand the results to Monthly.

spammy referrals

You will now see the list of hostnames with a lot of spammy hostnames. Note which are the valid hostnames for your site and create a filter.

This can be done from Admin, located at the end of the left side’s Analytics panel.


Next, create a new view for adding filter. Never add filters to your original view, as they are permanent rules set for your altering your Google Analytics data.

Creating a new view can be done from Create View button.

Create View button

Next, you need to name your new view. Do so and click on Create View.

Create View

And you are done! You will now be able to see it in the drip down menu of the View Column. Now you can add filters.

Select the new view. Go to Filters.


You will see the Add Filter button. Click on it and fill in your filter info.

Add the name, choose Custom as a filter type and then Continue. Make sure the Filter Field is Hostname.


In the Filter Pattern box, visible next, enter your hostnames using Regex string.

Simply add a (^) before the hostname and ($) sign after using it. Separate the hostnames with ( | ).

Before the dot sign add a backslash \ so that dot is not interpreted as a special character. You list of valid hostnames in the Filter should look something like this:


Save all changes. Wait 24 hours and check your Google Analytics report.

We hope this article was useful. Share with us your experience with Referrer Spam and how it has affected your site.

Nadejda Milanova

Get 10% off your order


Enter UYD-772-MK5 at the checkout to get 10% off one-time tasks or any maintenance plan.

Get started