134

Do you want to block WordPress referrer spam in Google Analytics?

Referrer spam sends misleading data to your website to pollute your website’s analytics reports with spam links.

In this article, we’ll show you how to block WordPress referrer spam in Google Analytics effectively.

What is Referrer Spam in WordPress and How Does It Affect Google Analytics?

Referrer spam in WordPress is a common spamming technique where fake traffic data is sent to a WordPress website.

This spam technique aims 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 may affect your website’s overall page views, bounce rates, and session reports.

Referral spam in Google Analytics

If you are seeing many suspicious-looking domains in your Referral reports, then they are most likely spam referrers.

Blocking these spam referrals will improve your Google Analytics reports and ensure that your data is not polluted by spam requests.

That being said, let’s take a look at how to easily block referrer spam in Google Analytics on a WordPress website.

Note: If you’re new and haven’t setup Google analytics properly, then we recommend using our guide on 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 referrer spam in Google Analytics.

For this you’ll need Sucuri. It is the best WordPress security plugin and comes with the best website firewall on the market.

It blocks most common website threats including referrer spam before they even reach your website.

Sucuri

Sucuri also comes with website monitoring, malware scanner, integrity check, and dozens of security features. This protects your website against hacking, malware, and brute force attacks.

Manually Blocking Referrer Spam in Google Analytics With a Plugin

If you are not using Sucuri, then you can use this method to check referral traffic and block them.

First, you need to install and activate the Stop Referrer Spam plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit the Settings » Referral Spam page to review plugin settings.

Block referrer spam plugin settings

The plugin uses a referral spam blacklist published by Matomo (Formerly Piwik, an open source analytics software).

You can also enter any suspicious domains that are already spamming your Google Analytics reports.

Don’t forget to click on the Save button to store your settings.

Be careful when adding domains in the plugin settings, as it will block all traffic from that domain name, including sub-domains.

3. Filter Out Ghost Referrers in Google Analytics

The first two techniques mentioned above will block referrer traffic that arrives at your website.

However, spammers may sometimes not send referral requests to your website. Instead, they would target your Google Analytics tracking code to trick it into recording a spam request.

These attempts will bypass filters on your website and may still appear in your Google Analytics reports.

You can filter these ghost referral spam in your Google Analytics account.

1. Block Unwanted Referrals in GA4

If your website is using Google Analytics 4 (GA4), then you can use the following method to remove unwanted referrals.

Simply log in to your Google Analytics dashboard and switch to the Admin view.

Select data stream

From here, under the Property column, select the Data Streams option. This will bring the Data Streams connected to your Google Analytics property.

After selecting your data stream you’ll see different settings. Simply scroll down to the Advanced Settings section and then click on the ‘More Tagging Settings’ tab.

Advanced Tagging Settings

Next, click on the ‘List Unwanted Referrals tab.

List unwanted referrals

This will bring you to the configuration screen.

Under Match Type, choose ‘Referral domain contains’, and then add the domain you want to block next to it.

Block domains

Click on the Add condition button to add another domain if needed.

Once finished, click on the Save button at the top 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

If you are still using older Google Analytics account that uses the Universal Analytics (UA Tracking) code, then you can use this method.

Simply switch to the Admin view under your Google Analytics account.

Creating a filter in Google Analytics

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 on the Add Filter button.

Add filter button

On the next screen, you can configure your filter settings.

First, you need to switch the Filter Type to ‘Custom’ and choose the ‘Exclude’ method.

Filter spam referrers from Google Analytics reports

After that, click on the ‘Filter Field’ drop-down and select the ‘Campaign Source’ option (this is where your filter will look for the match).

Lastly, add the domains that you want to block under the Filter pattern box in the following Regex Expression format.

spamwebsite.com|more-spam.com|.*spammysubdomain.com

Notice how the domain name and extension are separated by a backslash and a dot (.), and each domain name is separated by a pipe sign (|).

The last domain in the list has a dot and asterisk (.*) before the domain name. This asterisk blocks not only the domain name but also all its subdomains.

Go ahead and click on the Save button to store your filter settings.

Google Analytics will now remove these spam referrers from your reports.

Filters don’t affect on how Google Analytics collects data on your website. They just customize reports you view in your Google Analytics dashboard.

If you need to, you can always return to the filters screen to edit or delete a filter.

Edit or delete a filter in Google Analytics

We hope this article helped you learn how to block referrer spam in Google Analytics effectively. You may also want to see our ultimate conversion tracking guide for beginners or how to properly setup eCommerce tracking on your website.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Block WordPress Referrer Spam in Google Analytics first appeared on WPBeginner.

Want to receive personalized offers?

Allow notifications to get real-time updates about your shopping cart and who knows, you may even receive a sweet discount code 😊

Maybe later