Learn how to fix WP – Beginner’s Guide for WordPress

Learn how to avoid spam referrals from WordPress in Google Analytics

Learn how to avoid spam referrals from WordPress in Google Analytics

Do you want Google Analytics to stop tracking WordPress referral spam?

Learn how to avoid spam referrals from WordPress in Google Analytics – Referrer spam gives wrong information about your website so that spam links can show up in your analytics.

This tutorial will demonstrate how to successfully prevent WordPress referral spam in Google Analytics.

Learn how to avoid spam referrals from WordPress in Google Analytics

How Does WordPress Referrer Spam Affect Google Analytics?

Referrer spam is a common way to spam WordPress. This is when fake traffic statistics are sent to a WordPress site.

The goal of this spam method is to fill up a website’s analytics data with spam URLs, keywords, and domain names.

This data appears under “Referral Data,” which alters your Google Analytics statistics. It could also affect the total number of sessions, bounce rates, and page views that your website receives.


It is most certainly spam to referrers if you see a lot of suspicious-looking domains in your referral data.

By blocking certain spam links, you can improve your Google Analytics reports and stop spam requests from messing with your data.

So, now that we know that, let’s look at how to quickly stop referrer spam in Google Analytics on a WordPress site.

Note: If you’re new to Google Analytics and haven’t set it up properly, you should follow our instructions on how to install it in WordPress.

Referrer spam using Sucuri in Google Analytics.

This is the simplest method for blocking Google Analytics’ most common referral spam.

You’ll need Sucuri for this. It has the greatest website firewall on the market and is the best WordPress security plugin.

It stops the most common website risks, like referral spam, from ever getting to your site.


Sucuri also includes a virus scanner, an integrity check, website monitoring, and many more security tools. This safeguards your website against malware, brute-force assaults, and hackers.

Installing a plugin to manually block referrer spam in Google Analytics

If Sucuri is not being used, this method can be used to check and stop referral traffic.

Installing and activating the Stop Referrer Spam plugin is the first step.

Go to Options » Referral Spam after enabling the plugin to see its settings.


The plugin uses Matomo, which is an open-source analytics program that used to be called Piwik and has a list of spam referrals.

Additionally, you can add URLs you believe may be spamming your Google Analytics data.

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

A domain name added to the plugin’s settings will restrict all traffic from that domain name, including traffic from its sub-domains. Be cautious while doing so.

3. Remove Ghost Referrers from Google Analytics

If you use the first two techniques mentioned above, referral visitors won’t be able to reach your website.

However, sometimes referral requests may not be sent to your website by spammers. Instead, they would try to trick your Google Analytics tracking code into thinking of the request is spam.

These attempts will slip by the filters on your website and may still appear in your Google Analytics data.

This ghost referral spam may be filtered out of your Google Analytics account.

1. In GA4, block unnecessary referrals.

If your website uses Google Analytics 4 (GA4), the following method can help you get rid of referrals that aren’t needed.

To access the Admin view, just log in to your Google Analytics account.


From here, choose the Data Streams option from the Property column. All the data streams linked to your Google Analytics property will be brought together by doing this.

Many options will appear after choosing your data stream. Just scroll down to the “Advanced Settings” section and click on “More Tagging Settings.”


After that, choose the option labeled “List Unwanted Referrals.”


You’ll get to the setup page after doing this.

Select “Referral domain includes” under Match Type, and then put the domain you wish to ban next to it.


If another domain needs to be added, click the Add condition button.

When done, save your settings by clicking the Save icon in the upper right corner of the screen.

These referrals will no longer be included in your reporting from Google Analytics.

2. In previous versions of Google Analytics, block unwanted referrers.

This approach may be used if you still have an older Google Analytics account that makes use of the Universal Analytics (UA Tracking) code.

Simply go to your Google Analytics account’s Admin page.


From this point, you must choose the Filters option from the ‘View’ column.

The filter screen will appear as a result. Click the “Add Filter” button when you’re ready.


You may select your filter options on the next screen.

You must first change the filter type to “Custom” and choose the “Exclude” technique.


After that, pick “Campaign Source” from the “Filter Field” drop-down menu by clicking on it (this is where your filter will look for the match).

Finally, enter the domains you wish to ban in the following regex expression format in the filter pattern box.

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

A backslash and a dot (.) are used to separate the domain name and extension, and a pipe (|) is used to separate each domain name.

The last domain in the list is preceded by a dot and an asterisk (.*). The domain name and all of its subdomains are both blocked by this asterisk.

To save your filter settings, just click the Save button.

These spam referrers will no longer appear in your reports thanks to Google Analytics.

Filters have no impact on how Google Analytics gathers information about your website. All the reports you see in your Google Analytics dashboard are altered.

You may always go back to the filter screen to modify or remove a filter if necessary.


We really hope that this post has taught you how to successfully prevent referral spam in Google Analytics. You may also be interested in learning “How to Tag Your WordPress Posts Automatically and Save Time

Learn how to avoid spam referrals from WordPress in Google Analytics

Previous Post
Next Post