Back to Blog

How to Filter Spam Traffic In Google Analytics

Bots are a problem for website traffic. The good news is that it’s easy to identify spam traffic and apply filters to your Google Analytics.

how to filter spam traffic in google analytics
Categories for this post:

The purpose of Google Analytics is to understand user behavior and measure the performance of a website. It’s a powerful tool used by millions around the globe. It’s also riddled with referral spam traffic. Here we learn how to filter referral spam for your Google Analytics account, and block it from showing up again. 

TLDR: To ensure the data collected by Google Analytics is valid, create a filter to exclude traffic referred from selected domains. Go to the admin section of your Google Analytics account.

  1. Under the View column, click the “Filters” button.
  2. Click the red button “+Add Filter”
  3. Then follow the specific configuration for each of your filters.

What is Referral Spam Traffic and Does it Hurt My Website

Referral spam is created by bots (software applications that run automated tasks online) designed to send false HTTP requests to your website. This non-human traffic is known as bot traffic, and it accounts for nearly 40%  of all website activity. 

Referral spam is not directly harmful to your website, but it does artificially inflate your Google Analytics data. Skewed Google Analytics data is useless. Without data integrity, you can’t make accurate decisions regarding your website or your marketing strategy. 

How to Identify Spam Traffic in Google Analytics

Bots are a nuisance, but they’ve been spamming websites since the early days of dialup. The good news is that it’s easy to identify spammers and apply filters to your Google Analytics report so you only see legitimate traffic. 

Spam traffic typically shows up as a referral, but it can appear in any part of your reports even in unsuspecting places like language or page title. Oftentimes, spammers try to fool users with misleading URLs, emojis and unusual characters. Other indicators are:

  • A bounce rate of either 0 or 100%
  • A session time of 0 seconds 
  • A hostname referral that’s not set

There are all kinds of bots. Some are good. Many are bad. Regardless of how the bot manifests in your report, its traffic is useless. Regardless of the spam you find, you should:

  • Never visit the suspicious URL – The link may contain malicious script or redirect you to a site that promotes something you don’t want to buy. 
  • Never install scripts from unknown sites – If you already installed a script from an unknown site, you probably have malware. Scan your site and remove it immediately. 
  • Utilize filters to remove spam from your view – You need the necessary permissions to make changes in your Google Analytics account, but once you have admin access, you can create a new view to test new configurations like filters.

How to Stop Google Analytics Referral Spam Traffic

Unless you do something to stop them, bots will send referral spam to your website until the end of time. Fortunately, there are five ways to stop Google Analytics referral spam from mucking up your data. 

Exclude Known Bots and Spider

Google will do the bulk of the referral spam filtering work for you automatically. All you need to do is navigate to your test view “View Settings” and select the “Exclude all hits from known bots and spiders” button. This step will remove up to 80% of all bot traffic.

Filter Spam Bots 

Keep an unfiltered view to ensure your filters are working, and so you have data to compare with your filtered results. The best way to do this is to set up an unfiltered view in Google Analytics. 

You can set up a number of different spam filters in Google Analytics, but these will block the three most common types of spam:

  • Ghost Spam – Ghost spam is fake traffic inserted into your Google Analytics account by hackers to get you to visit their websites. You can remove ghost spam with a custom filter that tells Google Analytics which hostnames belong in your account and which do not.
  • Fake Language Spam – Language spam is used by spammers to promote their own sites or products. They manipulate the language used by real sites like thenextweb, lifehacker, and reddit. But you can remove it by creating a custom filter. Set field equal to “language settings” then paste \s[^\s]*\s|.{15,}|\.| into the filter pattern box.

Edit Your Domain’s .htaccess File

If your hosting uses cPanel, one of the most effective ways to block spam referral traffic is by editing your .htaccess file to not only block referral spam domains from your website, but also remove them from your server. 

For example, you could exclude Semalt,, and by adding the following command to your website’s .htaccess file:


RewriteCond %{HTTP_REFERER} semalt\.xyz [NC,OR]

RewriteCond %{HTTP_REFERER} free-traffic\.xyz [NC,OR]

RewriteCond %{HTTP_REFERER} buttons-for-website\.com [NC,OR]

RewriteRule .* – [F]

Remember, all it takes is one character in the wrong place to take your whole website offline. So be careful when editing anything related to .htaccess

Use a Third-Party Tool 

If you use WordPress, you can use a Google Analytics WordPress referral spam plugin to get rid of bot traffic. Here are just a few of your options:

Hire VisualFizz

If all of this sounds highly technical and confusing, it’s because it is. It’s also necessary to protect the data integrity of your website. Fortunately, you don’t have to create any of these filters or mess around with your precious .htaccess. All you need to do to protect your website data from spam is hire the experts at VisualFizz.

Contact us today to schedule a consultation. We’ll chat; learn about your business, then jump into your Google Analytics account to filter out all of the spam. With fresh, accurate data in hand, we can immediately get to work on a digital marketing strategy to increase conversions, and promote your business.

Upgrade Your Marketing

Chat with a team that understands well-developed full-service marketing.

Contact Us

Popular Articles

The Ultimate Guide to Branding a City, Smart City, or Municipality
People and products are brands. However, this concept strongly applies to cities as well. Since the...
Branding a City – Melbourne, Australia
Branding a City – Melbourne, Australia Branding a city is far different from branding a...
brand fails and bad ads of 2020 visualfizz digital marketing agency chicago
Worst Brand Failures of 2020 and What You Can Learn
Sorry to go all Midwest on yah, but… Geez Louise! Did this year suck, or...

Marketing Articles

what is the metaverse a blog post by chicago branding agency visualfizz
What is the Metaverse Today and in the Future
The term “metaverse” has been thrown around lately, from Facebook’s rebranding to video game marketing...
elements of highly effective fundraising landing pages for nonprofits charities and donations visualfizz chicago
The Best Landing Pages for NonProfit Fundraising
A landing page, in marketing terms, is a stand-alone page that is separate from the...
Biggest International Shopping Holidays of the Year by visualfizz digital marketing agency chicago
8 Biggest International Shopping Holidays of the Year
ECommerce sales across the globe have spanned 4.2 trillion US dollars, with more than two...

Contact Us to Learn More

"*" indicates required fields

Interested in learning more about our services?*