MY NUMBER 1 RECOMMENDATION TO CREATE FULL TIME INCOME ONLINE: CLICK HERE
Do you want to block spam from WordPress referrers in Google Analytics?
Referrer spam sends misleading information to your website to pollute your website’s analytics reports with spammy links.
In this article, we will show you how to effectively block WordPress referrer spam in Google Analytics.
What is referral spam in WordPress and how does it affect Google Analytics?
WordPress referrer spam is a common spamming technique where fake traffic data is sent to WordPress website.
The purpose of this spamming technique is to pollute a website’s analytics data with spam URLs, keywords, and domain names.
It affects your Google Analytics reports, as this data appears under referral data and can affect your site’s total page views, bounce rates and session reports.

If you see a lot of suspicious domains in your referral reports, they are most likely spammers.
By blocking these spam referrals, you will improve your Google Analytics reports and ensure that your data is not polluted by spam requests.
With that being said, let’s take a look at how to easily block referrer spam in Google Analytics on a WordPress site.
Footnote: If you are a newbie and haven’t set up Google Analytics properly, we recommend using our guide to how to install Google Analytics in WordPress.
Block referrer spam in Google Analytics with Sucuri
This is the easiest way to block the most common spam in Google Analytics.
For this you will need Sucuri. It is the best WordPress security plugin and comes with the best firewall for a website on the market.
It blocks the most common website threats, including referrer spam, before they even reach your site.

Sucuri it also includes website monitoring, a malware scanner, integrity checking, and dozens of security features. This protects your website from hacking, malware and brute force attacks.
Manually block referrer spam in Google Analytics with a plugin
If you are not using Sucuri, you can use this method to check the referral traffic and block them.
First you need to install and activate Stop referral spam to include. Check out our step-by-step guide for more details how to install a WordPress plugin.
After activation, you must visit Settings » Referral Spam plugin settings review page.

The plugin uses the referral spam blacklist published by Matomo (formerly Piwik, an open source analytics software).
You can also enter any suspicious domains that are already spamming into your Google Analytics reports.
Don’t forget to click the Save button to save your settings.
Be careful when adding domains in the plugin settings, as it will block all traffic from that domain name, including subdomains.
3. Filter Ghost Referrers in Google Analytics
The first two techniques mentioned above will block the referral traffic coming to your website.
However, sometimes spammers may not send referral requests to your site. Instead, they would target your Google Analytics tracking code to trick it into logging a spam request.
These attempts will bypass the filters on your site and may still appear in your Google Analytics reports.
You can filter this fake referral spam in your Google Analytics account.
1. Block spam referrals in GA4
If your site uses Google Analytics 4 (GA4), then you can use the following method to remove unwanted referrals.
Simply log into your Google Analytics dashboard and switch to admin view.

From here, in the Property column, select the Data Streams option. This will link the data streams to your Google Analytics property.
When you select a data stream, you will see different settings. Simply scroll down to the Advanced Settings section and then click the “More Tagging Settings” tab.

Then click on the “Spam List” tab.

This will bring you to the configuration screen.
Under Match type, select “Referring domain contains” and then add the domain you want to block next to it.

Click the Add condition button to add another domain if needed.
When you’re done, click the Save button in the upper right corner of the screen to save your settings.
Google Analytics will now exclude these referrals from your reports.
2. Block unwanted referrers in older Google Analytics services
If you are still using an older Google Analytics account that uses the Universal Analytics (UA Tracking) code, then you can use this method.
Simply switch to the admin view in your Google Analytics account.

From here, you need to click on the Filters option under the “View” column.
This will bring up the Filters screen. Go ahead and click the Add Filter button.

On the next screen, you can configure the filter settings.
First, you need to switch the filter type to “Custom” and select the “Exclude” method.

Next, click the “Filter Field” drop-down menu and select the “Campaign Source” option (this is where your filter will look for a match).
Finally, add the domains you want to block under the Filter Pattern field in the following regular expression format.
spamwebsite.com|more-spam.com|.*spammysubdomain.com
Note how the domain name and suffix are separated by a backslash and a period (.), and each domain name is separated by a vertical character (|).
The last domain in the list has a dot and an asterisk (.*) before the domain name. This asterisk blocks not only the domain name, but also all its subdomains.
Go ahead and click the Save button to save your filter settings.
Google Analytics will now remove these spam referrers from your reports.
Filters do not affect how Google Analytics collects data on your website. They just customize the reports you see in your Google Analytics dashboard.
If necessary, you can always return to the filters screen and edit or delete the filter.

We hope this article helped you learn how to effectively block spam in Google Analytics. You may also want to see ours the ultimate guide to tracking conversions for beginners or how to properly set up e-commerce tracking on your website.
If you liked this article, please subscribe to ours YouTube channel for WordPress video tutorials. You can also find us at Twitter and Facebook.
Publication How to Block WordPress Referrer Spam in Google Analytics first appeared on WP Beginner.
MY NUMBER 1 RECOMMENDATION TO CREATE FULL TIME INCOME ONLINE: CLICK HERE