You know how valuable Google Analytics is and you’re ready to take all the insights it can offer to improve your website’s performance.
But as you pull up the Acquisition data to see how people are finding your website, you notice some strange entries.
Chances are, this means that you’ve become a victim of spam bots.
What Is Google Analytics Referral Spam?
Spammers will do anything to drive more traffic to their websites. One of the tactics they’ve employed to this effect is finding ways to show up in Google Analytics, hoping that website owners will click on a site to see why it’s sending traffic their way.
Google Analytics referral spam used to be much more common, but Google works hard to keep those spammy sites from showing up in your data.
Nonetheless, many websites will still see some results in their Google Analytics data produced by spam bots. If you care about getting accurate data about your website’s performance—and you should, because it’s the only way to understand what’s working—then you need to filter spam bots in Google Analytics.
Here’s a handy guide on how to do just that.
How to Filter Spam Bots from Your Google Analytics Results
There are two main types of filters you should set up to capture most referral spam from bots. For both, you have the same first few steps.
1. Keep an unfiltered view.
When you make any technical change, you always want to have a backup. In Google Analytics, that means keeping an unfiltered view. This provides you with data you can use for comparison with the filtered results you get, to make sure they’re working. And it provides you with a view you can revert back to if one of your filters doesn’t work right.
To do this, go to the Admin section in Google Analytics by clicking on the Gear icon in the bottom left corner. Click on View Settings in the third column.
Click on Copy View, then name your view Unfiltered, or something similar.
2. Click on Filters under the View column.
With that done, go back to main Admin page by either clicking the back icon or the gear icon again. Click Filters in the View section (Note: this is different than All Filters in the Account section).
3. Click +Add Filter.
Click the red “+add filter” button. Then move onto the next section for the specific filters to create.
2 Google Analytics Filters to Set Up
Valid Hostname Filter
A valid hostname filter is the best way to filter out ghost spam. These are the spam bots that manage to ping your Google Analytics without ever actually visiting your website. Ghost spammers use automated scripts to send traffic to random websites, usually using a fake host.
By telling Google Analytics how to recognize a valid host, this type of filter cuts the ghost spam from your analytics view.
1. Find your hostnames in Google Analytics.
A valid hostname is anywhere that you’ve legitimately set up Google Analytics tracking. That includes your website, most obviously, but also services like marketing tools you use and payment gateways.
You can find a hostname report in Google Analytics in the Audience section by selecting Technology, then Network. Select Hostname as your Primary Dimension.
Set your date range to go back at least a year. Scan the list to identify your valid hostnames. You should be able to recognize these as your own domain name, and any tools you use and knowingly allowed access to your Google Analytics tracking. Anything you don’t recognize or don’t manage yourself is probably spam.
If there’s an entry you’re not sure about, do some Googling. For example, Google Web Light isn’t something I manage directly, but it’s a service Google provides to load speedier pages on mobile devices with slow connections. That makes it legit.
2. Create a filter listing your hostnames.
Back over in our Add Filter screen (scroll back up to the Getting Started section if you need a reminder), name the filter something like “Valid Hostnames.” Select Custom under Filter Types, Include in the list of bullets below that, and Hostname from the dropdown menu.
Under Filter Pattern, list all your valid hostnames in this format:
You want to fit all of your valid hostnames into one filter here—you can’t create more than one filter that includes hostnames.
3. Test your filter.
Before you click save, take a few seconds to test the filter out and make sure you configured it right. You can use the Verify Filter option right there on the page to run a basic test and see how the filter would affect your data for the past 7 days. Note that, if your website doesn’t currently get that many spam hits, 7 days might not be enough of a sample set to show a difference.
Once you’re confident your filter is accurate, click Save.
Crawler Spam Filter
The other main category of spam bots that show up in Google Analytics is crawler spam. These are bots that actually do visit your site. They leave a correct hostname, so won’t get caught in your valid hostname filter. Instead, you need to exclude these from your analytics.
1. Find the crawler spam in your analytics.
To start, identify the crawler spam that shows up in your analytics now. In the Acquisition menu, choose All Traffic, then Referrals. Change your date range to include at least a year. Now browse the list of websites to look for any that appear to be spammy.
Some will look immediately suspicious. For example, display-your-ads-hereti.info jumps out in the list above as probably spam. But for anything you’re not sure about, do a Google search for “what is <URL>” and you can usually get your answer for whether or not it’s spam.
If the list here is long, it’s probably not worth your time to try and filter out every single spam bot, but if there are a main few sending a lot of fake traffic to your site, make note of them to include in your filter.
2. Look up common crawler spam lists.
In addition to the spam examples you find in your own analytics, you can find pre-created filters that list many of the most common offenders on sites around the web (such as here and here). These will cover many of the spam bots that may not have hit your website yet, but could.
3. Create a filter (or multiple filters) listing the crawler spam.
Back in our Add Filter screen, name your filter something like “Referral Spam.” Choose Custom as your Filter type, click on the Exclude button, and select Campaign Source in the dropdown menu.
For the pre-created filters you find, you can simply copy-and-paste them into your Google Analytics. For any you manually create, use the same format you did for your hostname filter:
Since you have a limited number of characters you can use for each filter, you’ll likely be creating several different filters in this step. Be sure to give them each a unique name.
4. Test your filter.
For each filter you create, take a minute to test it. If you’re satisfied it’s accurate, click Save.
Filtering Spam Bots on a WordPress Site
Setting up filters within Google Analytics can feel pretty complicated. But if you have Google Analytics set up for your WordPress website, you have an easier solution you can take advantage of: plugins.
There are a number of WordPress plugins devoted to blocking referral spam, including:
You can block a significant amount of spam from your analytics simply by choosing one of these plugins, installing it to your WordPress site, and activating it.
If you’re not on WordPress now, but liking the idea of a simpler process for filtering spam bots, the first step to setting up a WordPress site is investing in WordPress hosting. Many aspects of designing, managing, and maintaining a website are easier with WordPress, so for website owners without extensive tech skills, it’s worth considering.
Google Analytics Spam Bots FAQs
Those are the main steps you need to know to filter spam bots in your Google Analytics. But if you still have questions about Google Analytics spam bots, here are answers to some of the most common questions people wonder about.
1. How do I detect spam in Google Analytics?
First things first, don’t click on the link! If you visit the website itself, the spammers are getting what they want from their shady tactics.
Instead, either do a search for the website in quotation marks, e.g. “99-reasons-for-seo.com” or a search like “what is 99-reaons-for-seo.com.”
That will ensure Google doesn’t take you to the spammer’s website—the thing we’re trying to avoid here—and instead you’ll see results from other websites about it. If the website’s a known source for analytics spam, someone’s probably written about it.
2. Why does filtering spam from my Google Analytics results matter?
Website analytics are a rich source of information about what your audience responds to. They can show you what your website gets right now, and reveal areas for improvement. And they’re your best way to track the success of your online marketing activities so you know what tactics are worth the investment.
Referral spam clouds the accuracy of your analytics. It puts you at risk of misinterpreting the data you have, because the data itself isn’t accurate. You don’t want to spend time and money on tactics that aren’t working because a spam bot makes you think a particular page is more popular than it truly is with your audience. By cleaning up your data, spam bot filters ensure your analytics deliver insights that are more accurate and useful.
3. Can I clean past Google Analytics data?
These filters will mean you get cleaner data moving forward, but they won’t be applied retroactively. Your historical data will still include inaccuracies caused by spam bots.
But, seeing the comparison between your analytics before and after applying the filters can help you make an educated guess about how much of your traffic was due to bots. You can take that into account when analyzing the data you have to help you get closer to an accurate picture.
Gain Clarity by Skipping the Spam
Google Analytics is one of the most valuable tools available to every website owner. While you can’t completely avoid spammers online (they have an obnoxious skill for being everywhere), you can control the influence they have on your website data.
Applying the right filters and plugins to your website analytics will rob spammers of their power, and give you back the accuracy you need to build a stronger website for your audience.
Kristen Hicks is an Austin-based freelance content writer and lifelong learner with an ongoing curiosity to learn new things. She uses that curiosity, combined with her experience as a freelance business owner, to write about subjects valuable to small business owners on the HostGator blog. You can find her on Twitter at @atxcopywriter.