Unfortunately, spam has become the most annoying aspect of web surfing. Furthermore, different kinds of spam jeopardize a website’s security and performance to a certain extent.
The story does not end here. They can affect Google Analytics settings, causing website owners to lose their visibility and rankings on search engines.
This blog post will describe how to block referrer spam in Google Analytics without difficulty.
What Do You Mean By Referrer Or Referral Spam?
Referral or referrer spam repeatedly makes a fake website request using a shady referral URL. Spammers utilize this shady technique to promote a particular website.
What is the Main Objective of Referrer or Referral Spam?
The primary motive behind referrer spam is to deceive or attack search engines. Therefore, spammers, hackers, and other cybercriminals promote their websites by sending multiple requests using fake URLs.
These URLs are linked with websites spammers wish to promote. Moreover, they wish to enhance the visibility of their websites in search engines without offering top-notch content to users.
Your website can link back to spammers’ sites or poor-quality sites and enhance the ranking of shady sites such as:
When Google notices that your site has been linked to a junk site, it can decrease your rankings. These sites can also hamper your Javascript tracking code, negatively affecting your bounce rate and other analytics data.
What’s the Reason Behind Calling Referral Spam?
Referral spam unusually communicates with Google Analytics. The former deceives the latter in assuming that other sites are responsible for traffic to your website.
In reality, spammers use the assumption in their favor that all site owners want to receive referring traffic from other sites to their platforms.
You can explore Google Analytics’s referral document or report to confirm your website traffic source. However, there is a strong likelihood that you may click spammy links when examining referrals or referrers in Google Analytics.
What Should We Do to Block Referrer or Referral Spam Traffic in Google Analytics?
Fortunately, you can try out a few possible options to block referral spam in Google Analytics. These options are:
- Remove Spider and Known Bots Using Google Analytics Settings
- Filter Spam Bots from Your Google Analytics Results
- Edit Your Domain’s .htaccess File
- Third-Party Tools for Blocking Referral Spam
– Remove Spider and Known Bots Using Google Analytics Settings
When blocking referrer spam in Google Analytics (GA), go to Admin > View Settings > Bot Filtering:
Do remember to enable or activate the checkbox and click the ‘Save’ button.
– Filter Spam Bots from Your Google Analytics Results
You must first set up an unfiltered view to filter spam bots from Google Analytics (GA). This way, you can compare the data with the filtered results to ensure accuracy and revert to the original settings if needed.
To set up or configure an unfiltered view, visit the Admin section > View Settings. Then click Copy View and name your view Unfiltered.
Revisit the main Admin page in GA (Google Analytics), and click Filters using the View section.
Now, click the Add Filter button, which is highlighted in red. Thus, you can add a new filter to Google Analytics (GA) and name it appropriately.
You can enable a few critical spam filters to block Google Analytics spam. After creating these filters, test them to ensure they work properly. When you are satisfied, click ‘Save’.
Types of Spam
There are three key types of spam: Ghost Spam, Crawler Spam, and Fake Language Spam.
Ghost Spam, also known as phantom traffic or ghost traffic, is fake traffic, and data hackers, spammers, or other cyber thieves insert into your GA account to encourage you to browse their sites.
You can find ghost spam in your Google Analytics account by going to Audience > Technology > Network > Hostname. This will display all hostnames in a comprehensive list that engage with your site.
This list will also highlight domains, subdomains, and other miscellaneous services you have associated with your GA account.
To remove ghost spam in Google Analytics, here is what you should do:
- Use a regular expression to write valid hostnames in a single list, separating them via a pipe character | and add a backslash \ before all periods and hyphens.
- Open your GA account, go to Admin > right view > Filters > Click Add Filter.
- Give your filter a title, select Custom for filter type, and choose that you wish to ‘Include’ ‘Hostname.’
- Enter your expression and use the ‘Verify Button’ to see if the new filter works. Click ‘Save’ to complete setting up your ghost spam filter.
Bots generate Crawler Spam that performs automated tasks on websites. By doing so, it browses websites and logs information.
If you want to remove crawler spam in Google Analytics, create the custom filters in GA with the following expression:
Expression #1:
(best|dollar|success|top1)\-seo|anticrawler|^scripted\.|semalt|forum69|7makemon|sharebutton|ranksonic|sitevaluation|dailyrank|vitaly|profit\.xyz|rankings\-|dbutton|uptime(bot|check|\.com)
Expression #2:
Datract|hacĸer|ɢoogl|responsive\-test|dogsrun|tkpass|free\-video|keywords\-monitoring|pr\-cy\.ru|fix\-website|checkpagerank|seo\-2\-0\.|platezhka|timer4web|share\-buttons|99seo|3\-letter|top10\-way
When creating a custom filter:
- Open your GA account, go to Admin > right view > Filters > Click Add Filter.
- Give your filter a title, select Custom for filter type, and choose ‘exclude.’
- Set a field equal to ‘campaign source’ and paste one expression into the box. Now, verify the filter and click ‘Save’.
- You can follow the same process for Expression #2.
Spammers benefit from Fake Language Spam when marketing their products or websites. They make changes to the languages real websites use, such as reddit.com, lifehacker.com, techcrunch.com, etc.
To get rid of fake language spam in GA, here is what you should do:
- Open your GA account, go to Admin > right view > Filters > Click Add Filter.
- Give your filter a title, select Custom for filter type, and choose ‘exclude’.
- Set a field equal to ‘language settings’ and paste the below-mentioned code into the filter pattern box:
\s[^\s]*\s|.{15,}|\.|
- Now, verify the filter and click ‘Save’.
– Edit Your Domain’s .htaccess File
Editing your .htaccess file is another way of blocking spam referral traffic. The file helps manage your server, and you can instruct it to block any illegitimate or obnoxious visits from an IP address or domain.
To block referral spam traffic by excluding buttons-for-website.com, free-traffic.xyz, and more, add the below-described command to your .htaccess file:
## SITE REFERRAL BLOCK RewriteCond %{HTTP_REFERER} buttons-for-website\.com [NC,OR] RewriteRule .* – [F]
– Third-Party Tools for Blocking Referral Spam
You can take advantage of a notable website security platform, Sucuri. The platform helps website owners detect and block referrer spam from their websites. Sucuri offers crucial security features, such as DoS (Denial of Service) mitigation and malware scanning.
How to Block Referrer Spam in Google Analytics 4?
You can smartly utilize the built-in feature, List Unwanted Referrals, to identify sources or domains you do not want to categorize as referrals.
- Visit the Admin section using your GA4 account, go to Data Collection and Modification, and click Data Streams.
- Choose your Web Stream, and click ‘Configure tag settings.’
- Click the ‘Show All’ option using the Settings section.
- Find and Click the ‘List Unwanted Referrals’ option.
- Using the ‘Include referrals that match ANY of the following conditions’, select a match type, for instance, Domain.
- Write the domain you wish to exclude from referral traffic, for instance, “[Invalid URL removed].”
- Click ‘Save’.
You can include various domains and separate them with commas depending on your need.
Once you enable the settings, traffic from such domains will be assumed to be ‘direct’ traffic in the GA4 reports, removing these domains from the referral spam category.
Looking For Professional Help?
If you want to track and optimize events within the GA4 interface, look no further than WPExperts. The leading WordPress development company offers exclusive Google Analytics 4 services to small and large businesses, allowing them to enhance their websites’ user experience.
Thus, they can increase conversion rates and revenues in the long run.
Wrapping Up – How to Block Referrer Spam in Google Analytics [2024]
We expect you to like our exclusive blog post explaining how to block referrer spam in Google Analytics. Sadly, you cannot completely avoid spam.
However, you can reduce the consequences of spam by smartly identifying and removing it from your Google Analytics system.
In this situation, you must add technical expertise to your arsenal to help you tackle the challenges imposed by hackers or spammers.
For that reason, you can use the required filters and tools to minimize spam’s impact on your Google Analytics data.