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
gammatraffic.com (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
www.trafficcity.club 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
- Click the gear icon
Adminin the bottom left corner of Analytics
Data Streamsin Property section.
- Click the appropriate data stream.
More tagging settingsat the bottom.
- Click on
List unwanted referrals.
- Set the
Referral domain containsand enter the domain you want to exclude in the
- Click the
Savebutton 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.
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:
- Enter a filter name. Make sure to use a name that is easy to understand. 2.
- Select the filter Type
- 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)
- If you want to filter by account, select the view you want to apply the filter to in the
Apply Filter to Viewsection.
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
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
In the above example, either
. *spammysubdomain.com will be excluded.
The last one
. *spammysubdomain.com indicates the domain containing
spammysubdomain.com, 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.