The other day, I found a new referrer spam. So I did referrer exclusion in both Google Analytics Universal Analytics and GA4. It seems that referrer exclusion was not possible in GA4 before, but now it is easy to do, so I will explain.

Referrer spam we found this time

This time the spam was leading to a site (don't access it!).

Since the organic traffic was increasing in one of the site I manage, so I checked the keywords and found that and were listed at the top.

Obviously, something is wrong.

When I accessed the site, I was redirected to

Please do not access this site.

Steps to exclude referrers in GA4

  1. Click the gear icon Admin in the bottom left corner of Analytics
  2. Click Data Streams in Property section.
  3. Click the appropriate data stream.
  4. Click More tagging settings at the bottom.
  5. Click on List unwanted referrals.
  6. Set the Match type to Referral domain contains and enter the domain you want to exclude in the Domain field.
  7. Click the Save button in the upper right corner.

You can also refer to the following image.

To exclude referrers in universal analytics.

In this case, use a filter.
The filter can be done on a Account basis or individually on a View basis.

! Caution.
Filters are not applied to past data. Therefore, the data may fluctuate significantly before and after the filter is applied.
When applying a filter on a large site, it is safer to apply it to a new view.

Also, even if you remove the filter, the data during the period of application will still be the one collected with the filter applied. Please note that the data will not return to the data before the filter was applied.

The procedure is as follows:

  1. Enter a filter name. Make sure to use a name that is easy to understand. 2.
  2. Select the filter Type Custom.
  3. Select Exclude.
  4. Select Referral for Filter Field
  5. Enter the domains you want to exclude in the Filter Pattern (you can enter a single domain name or multiple domain names using regular expressions)
  6. If you want to filter by account, select the view you want to apply the filter to in the Apply Filter to View section.
  7. Click Save.

You can also refer to the following images.

In the example above, I selected Referral in step 4, but you can select items such as Search Terms or Language depending on the spams.

In the case of this spam, the keywords of the organic access contained spam strings, so it is better to select Search Terms.

You can use regular expressions in filters

The filter pattern in Universal Analytics also supports regular expressions.

So if you want to exclude multiple domains from a referral, you can enter like the following in the filter pattern

example\.com|secondexample\.com|. *spammysubdomain\.com

In the above example, either,, or . * will be excluded.

The last one . * indicates the domain containing, which can be used to exclude subdomains.

Also, be careful not to end a sentence with a pipe |. If it ends in a pipe, it will exclude all referrals.

What is referrer spam?

Referrer Spam is the act of an annoying person called a spammer. They access a site by setting their site as a referrer, etc., trying to make us access their sites.

In Google Analytics, you can check the referrers, etc., and the purpose of the spammer is to get you to access the referrer displayed there.

In some cases, they may want you to visit their site, but in other cases, they may be leading you to a phishing site or a site that contains malicious programs.

Author Info
Profile Icon

Director of web and marketing

Kota Shimizu

I've been working in web, video, and magazine production fields, experienced planning, design, photography, coding, marketing, and business improvement. I'm an omnivorous director who can handle anything in a widely.