Analytics my profession

SEO my passion

User Experience my obsession

Follow me on
Category | Google Analytics
Difficulty |

How to Efficiently Deal with the Spam in Google Analytics

This Analytics guide:

  • will help you stop and remove any type of spam (referral, keyword, page, language, etc.)
  • will work independently of the platform you use (WordPress, Weebly, Shopify, Wix, Squarespace, etc)
  • is regularly updated to deal with new spam tactics (you can keep it as a reference)
Most recent spam (Last Checked: July 25, 2017)
  • Covered by the hostname filter:,,,
  • Covered by the crawler filters:  many from the spammer (,,
List of latest spam
Recent Referrer SPAM List / referral / referral / referral / referral / referral / referral / referral / referral referral
Recent Keyword, Page and now Language Spam List
Language: Language: " search shell" Page title: "Vitaly rules google"
Page: / Page: / Keyword: cdn
Keyword: MULTIPLE combinations using ""
Keyword: MULTIPLE (30+) combinations ending with
Get notified about important updates related to spam and data quality for your Google Analytics

If you keep looking for a solution for spam in Analytics, you came to the right place.

The main issue with Analytics spam is that the spammers keep changing names and methods (referrals, keywords,  languages) which make commonly shared solutions based on the name of the spam essentially useless and a waste of time.

Luckily there is a much better way!

In this guide, not only will I show you how to get rid of them efficiently, so you don't waste your time constantly updating filters every time new spammer shows up, but also how to do it safely so you don't risk your real data. 

Don't have the time to apply these solutions? I can do it for you.

Myths about the spam in Analytics

Before getting to what you should do let's review what you shouldn't. If you made any of the mistakes below, undo the changes if possible.

The Right Way of dealing with the spam

The solutions I'm going to show you have been proven to work for over two years regardless of the forms used by spammers (referral, keyword, page, language, etc.)

Don't belive me? Click here to see examples of users that followed this guide

The following screenshot shows some examples of analytics users that followed this guide:

  • The data in blue: Segment of data showing only spam traffic.
  • The Orange line: The moment when the filters from this guide were applied to that Analytics property.
Permanent filters for spam applied graphs

So I will show you how to get these results for your Analytics.

How to Remove All Referral, Page and Keyword Spam in Your #GooogleAnalyticsClick To Tweet

Here is what you will accomplish by the time you've implemented the instructions in this guide:

  1. Protect your data by following a few best practices for your views.
  2. Stop the spam and other junk traffic with efficient filters that don't need to be constantly updated.
  3. Clean your historical data with an advanced segment.

You can use the Quick Navigation   on the right side of your screen to quickly jump between sections.

1. Protecting your Data from Misconfigurations

This step is not strictly required to clean your analytics, but it is still important to protect it from possible misconfigurations. Every Google Analytics account should have at least the following views:

  • Master - View where you will apply filters. Used for analysis
  • Unfiltered - Your backup view, which, shouldn't have any filter or any setting that alters the incoming data.
  • Test (Optional) - if you want to be extra cautious you can create a test view that you can use to try the filters.

If you are already following these best practices, go to the next step. If you haven't and need help, here you can find the instructions on how to create an unfiltered and a test view

2. Stopping Google Analytics Spam and Other Junk traffic

Once your views are correctly configured, the next step is blocking all of that dirty traffic that inflates your reports and don't let you see the real performance of your site. This is what you will do:

  1. Filter for Ghost Spam (for referral, page, keyword spam)
  2. Filter for Crawler Spam
  3. Filter for Fake Languages and Other Less Common Spam
  4. Extra: Filter for Internal traffic
  5. Extra: Enable the built-in feature Bot Filtering (to exclude known bots)

Want help from a professional?

General notes about filters.

  • While most of the time filters start working in minutes, officially it may take up to 24 hours before the filter effects become visible in your data, so be patient.
  • You will apply the filters either in the master view, the view(s) to be used for analysis, or the test view if you want to try them first.

a. Creating a Valid Hostname Filter for Ghost Spam

This is the single most effective solution against the spam. This filter will permanently stop all traffic from common spammers like sharebutton, earn-from-articles sites, organic spam, and most of the language junk.

The difference between this solution and other commonly shared is that this filter is based on something that you control, your hostnames.

What is a hostname? click here to expand

There is one thing I want to make clear because it sometimes causes a bit of confusion. Some people mistake the hostname with the source.

The Source is where your visit comes from and there can be any number of them, for example, Facebook, Google, Twitter, Youtube, links from other sites to your site, etc.

The hostname, on the other hand, is the site where the visitor arrives. Your main hostname will be your domain and, and depending on the configuration of your site, there may be others.

Source vs Hostname Google Analytics

So as long as you add all of them you don't have to worry, you won't exclude any real traffic.

The main characteristic of ghost spam is that it never visits your site. Instead, it uses the measurement protocol to reach your GA directly. For that reason, this type of spam always leave a fake hostname or leaves an "undefined" hostname which will appear as (not set) in your reports.

If we use this to create a filter that will only let pass traffic with valid hostnames, all ghost traffic will be automatically excluded. This solution is much more efficient than the one commonly used, which is to create a filter with the name of spam. Plus this technique will work for any type referral, keyword, page, language, etc.

There are 3 things you need to do to build this filters
1. Find and make a list of your Hostnames: At least you should have one main hostname which will be your domain and depending on your site configuration you may find others. To see a list of all your active hostnames you should go to the Network report in your Analytics and select the blue text "Hostnames" at the top of the report. Make a list of all the valid ones.Not sure which are your valid hostnames? click here to expand the instructions

How to find your hostname report

The most important part of this method is getting a list of all your valid hostnames to avoid excluding any legitimate traffic. For that, you will need to find your network report then select hostname at the top of the report.

  1. On the reporting section, select a wide time frame on the calendar, go to the Audience reports in the sidebar.
  2. Expand Technology and select Network
  3. Make sure you select Hostname at the top of the report (by default Service Provider is selected), you will see a report with all your hostnames (real and fake).How to find the hostname report - Google Analytics
  4. Make a list of all relevant host names you find. At least you should see one that will be your primary domain. The rest depends on the configuration of your site and all the services that have added tracking code (UA-000000-1). Here are some examples:
    Your main domain: Subdomains:
    Translate services: Bing translate Shopping Carts: Shopify
    CDNs: CloudFlare Video Services: Youtube
    Cache Services: Google cache IP's:
    Payment Services: Paypal

    An invalid hostname is essentially any other that you do not know or control. For example:

    - Hostnames with URLs pointing to the spammer website.
    - Known sites that may no look spammy but you don't control like, or  (spammers use them to mislead people)
    - The most common hostname for spam (not set), this happens when the spammer doesn't even bother to set a fake hostname.

    The following screenshot is an example of a hostname report:

    Green: Valid  Red: Spam
    Google Analytics Hostname Report
    These are just examples of hostnames, don't add hostnames that are not on your list

    From the report above we get the following valid hostnames. Remember we are looking for real valid hostnames to include, not to exclude.
2. Build your Hostname Expression: Once you have the list of all your hostnames, you have to create a regular expression (REGEX) that contains all of them.Need help to build your hostname expression? click here to expand the instructions

How to build your valid hostname filter expression

Once you gather all of your valid hostnames, you should create Regular Expression (REGEX) that matches all of them. Here are some tips to help you build your expression:

  • To separate each hostname, you should use a bar or pipe character |, this works as OR, if you can´t find it, hold Alt + 124(Numeric pad)
  • The dot . and the hyphen - are considered special characters in REGEX so you should add a backslash \ before them.
  • Try to find a good way to match as many hostnames as you can, for example, if you want to match,,, you don't need to add all of them to the expression entering ohow, will be enough to match all of them (just avoid using common names).
  • Don't leave any spaces.
  • The REGEX has a limit of 255 characters if your expression exceeds this limit try to optimize it to keep everything under one expression because you can only have 1 Include hostname filter
  • Don't add a pipe/bar |, at the beginning or the end of the expression.
  • More about Regular Expressions

Following the recommendations above and using our list of Valid hostnames:

List of hostnames found in the report

We can build the expression that will match all of them:


It is important that you add all your relevant hostnames, or you will lose valid data. If you want to be extra sure that you are not missing any, you can test your expression using a quick segment or by testing your filter for a few days in a test view.

Do you need help finding your hostnames and configuring the filters?

3. Create the valid hostname filter: Once you are sure the expression is correct, create an include hostname filter to get rid of all that nasty ghost spam once and for all.

How to Create a Valid Hostname Filter to Stop Ghost Spam

To block all ghost spam in Google Analytics, you need to create an include hostname filter:

  1. Go to the Admin tab, and select the view where you want to apply the filter. If you follow the naming above, this will be the Master view or Test view.
  2. Select Filters under the View column, and select + Add Filter
    Add filter button Google Anlaytics
  3. Enter as a name for the filter Valid Hostnames.
  4. In Filter Type, select Custom
  5. IMPORTANT: Make sure you choose Include (you may need to scroll down a little) and select Hostname from the dropdown.
    How to create a valid hostname filter - Google Analytics
  6. Copy and paste the hostname expression that you built into the Filter Pattern box. If you click on Verify this filter, you will get a quick glance of how the filter will work. You should only see spam or irrelevant hostnames on the left side of the preview table.

    If you get the message below, is probably because of the limited data used by this feature

    This filter would not have changed your data. Either the filter configuration is incorrect, or the set of sampled data is too small

    Try verifying it with a quick segment (if you haven't done it yet).

  7. After making sure your filter is ok, Save the filter.

IMPORTANT: This filter will stop most of the spam and doesn't require updates for new ghost spam, but it's essential to update the expression whenever you add the tracking ID to new service or domain.

How to Remove Referral, Page and Organic Spam in Your #GooogleAnalyticsClick To Tweet

b. Creating a filter for Crawler Spam

Crawler spam is harder to detect since it uses a valid hostname, so you'll need a different filter with an expression that matches all known crawler spam.

To save you some time, I've created an optimized REGEX for crawler spam that you'll find below in the instructions, or If you prefer, it can be built the same way as the valid hostname expression. This time, you will use the source (referral) name.

How to Stop Crawler Referrer Spam in Google Analytics

To stop referral spam you will need to create an exclude filter using the campaign source:

  1. Go to the Admin tab.
  2. Under the last column "VIEW", select Filters  and then click + Add Filter Add filter button Google Anlaytics
  3. Enter "Crawler Spam" as a name.
  4. Filter Type > Custom > Exclude
  5. Filter Field > Campaign SourceHow to stop referrer spam in google analytics
  6. Filter Pattern > Paste the following crawler spam expression.
    The expressions have been completely rewritten to include more crawlers in fewer characters. If you created this filters before May 10th, 2017, just replace your expression with the following ones.

    Create 1 filter for each expression

    Crawler Expression 1


    Crawler Expression 2


    Crawler Expression 3


    Crawler Expression 4



    Get notified whenever I detect new crawlers. You will receive the updated expression directly to your email.

    You can click on Verify this filter to have a quick glance of how the filter will work. You should only see referral spam on the left side of the preview table.

    Due the small sample data used by this feature to test the filter, it is very likely that you will get the following message:

    This filter would not have changed your data. Either the filter configuration is incorrect, or the set of sampled data is too small

    If you followed the instructions carefully, don't worry; the filter will work. Alternatively, you can verify the filter with a quick segment.

  7. After everything is set Save.

Note: You may find other referrals that may not be spam, but neither relevant for you. For example, mobile test sites or cache sites. You can create a similar filter with the same configuration and add all the irrelevant referrals there to keep your data pristine and reliable.

Prevent any Form of Spam in Google Analytics With the Right Filters.Click To Tweet

c. Creating a Filter for Fake Languages and Other Spam Types

This is the latest form of spam in Analytics, the hostname filter will prevent most of it, however, there are a few hits that may sneak in, a kind of mix of crawler and ghost spam.

I've also added a language that doesn't come from spam but it comes from bots which are also irrelevant for your data. You may see it as language c

I prepared the following expression to prevent any language that doesn't have a proper format like en-us, en-uk, es, etc. and added at the end the bot language represented by the letter "c"

  • To create a language filter follow the same steps as the crawler filter above and change
    • In Filter field to Language Settings
    • In Filter pattern box enter the following expression as it is:
  • Click "verify this filter" to check if everything is ok. You should see only fake languages on the left side of the preview table.

Fake Page Title

  • Update (Feb 25, 2017): A few sites are getting a combination of ghost and crawler spam. If you are still getting and other fake referrals, after adding the previous filters do the following.

    • In Filter field to Page title
    • In Filter pattern box copy the following expression as it is:

d. Extra: Excluding Internal Traffic

Although this type of traffic is not spam, it can be as dangerous to your analytics. If you don't apply filters for the traffic generated by you or other people of your team, this data will get mixed up with your real visits data, and a difference with the spam, this is much harder to identify later.

To create this filter, you will need the public IP of the network/wifi you want to exclude. You can find it here. You will see something like this  12.345.678.90 or the longer version IPv6

If you need help building this filter and other methods you will find full instructions for internal traffic filters in this post.

e. Extra: Enabling "Exclude all hits from known bots and spiders"

There are many other crawlers around that are not spam but neither useful for your reports. For example, the ones crawling your site for indexing. This bots will leave a record in your reports if not excluded.

In this case, is a bit easier because Google Analytics has a built-in feature to exclude this traffic.

How to enable bot filtering

Repeat the following steps for all your views

  1. Again in the Admin Tab, select one of your views under the VIEW column in the admin section.
  2. Click View Settings
    Bot Filtering in Google Analytics
  3. Near the bottom check the box Exclude all hits from known bots and spiders (Bot Filtering)
    Exclude all hits from known bots and spiders
  4. Save and repeat the process with all your Views

You can see the more details about Google Analytics Bots and Spider Filtering here.

3. Cleaning up the Spam in Google Analytics (Historical Data)

The spam that is already stored in your Analytics (or any data for that matter) can't be permanently deleted. That is why it is important to create the filters to stop receiving junk traffic.

However, you can still clean your past data affected by spam by using the valid hostname expression you built previously and an advanced segment.

How to Remove the Spam from Google Analytics Historical Data

To eliminate the spam from your Google Analytics historical data you will have to create an advanced segment:

  1. In the Reporting section, click the box that says All Users (at the top of the graph). Next click the red button +NEW SEGMENT
    New Segment GA
  2. In the segment window, almost to the bottom click Conditions advanced-segment-to-remove-referrer-spam
  3. First condition:
    • Filter > SessionsInclude
    • Dropdown 1> Hostname
    • Dropdown 2 > matches regex
    • Textbox > Paste the Hostname Expression that you previously used for the filter.
  4. Click +Add Filter at the bottom to add a new condition.
  5. Second Condition:
    • Filter >Sessions >Exclude
    • Dropdown 1 > Source
    • Dropdown 2 > matches regex
    • Textbox > Paste the Crawler Spam expression

    The following expression is optimized to clean all crawler spam detected over the last couple of years.


    Get notified whenever I detect new types of spam. You will receive the updated expression directly to your email.

  6. Click the button Or to the left of the condition you just configured
  7. Third Condition
    • Dropdown 1 > Language
    • Dropdown 2 > matches regex
    • Textbox > Paste the following expression
  8. Update (Feb 25, 2017): A few sites are getting a combination of ghost and crawler spam. If you still see and other fake referrals, after adding the previous conditions do the following.

    Click +Add Filter at the bottom to add a new condition.

    Fourth Condition:

    • Dropdown 1 > Page Title
    • Dropdown 2 > matches regex
    • Textbox > Paste the following expression
  9. Enter All Users - clean" as a name for the segment and Save.

After saving the segment, you will be able to see spam-free reports, as long as the segment is selected. Eventually, the filters will do their work, and you won't need to use the segment anymore.

Prevent any Form of Spam in Google Analytics With the Right Filters.Click To Tweet

Security, SEO, Rankings and other Concerns

Because the article was getting too long, I divided the theoretical from the practical part. If you have more questions or concerns, you can also check the FAQ I made about the spam in Google Analytics. Things like:

  • Does the spam harm my SEO-Rankings?
  • Is Google doing something to handle this threat?
  • How does it get in your reports?

These and many other answers and demonstrations.

Other ways of improving your Analytics

Cleaning up your analytics is an important part of getting reliable data. To ensure you get even better insights, I recommend you to follow these best practices.


Google Analytics is a powerful tool that will help you understand your traffic but it will take some work if you want to ensure you receive clean and trustworthy data. Otherwise, you might be pointed to the wrong direction.

"Even on high volume websites were data spamming would be marginal, you still have to explain why there's such a discrepancy. As an analyst you can't dismiss it simply by saying "nah... we're not too sure what it is, but I heard about that spamming thing..."

-Stéphane Hamel

By applying these solutions, you ensure that you will receive accurate data. These solutions have been proven to work for over two years regardless of the tactics used by spammers as the following screenshot shows.

  • Data in blue segment of data showing only the spam in the property
  • Orange line represents the moment when the filters from this guide were applied to that property.

Permanent filters for spam applied graphs

Do you have any Questions/Feedback?

I've tried to cover every important detail in this article, however, if there is any part of the guide where you got stuck, let me know in the comments section below and I'll try to clarify it for you.

Do you want me to review your Analytics and apply these solutions?

Spam hits thousands of Google Analytics users. If this article helped you, please consider sharing it or leaving a comment with your experience. It may help other people! :)

How to Remove Referral, Keyword and Page Spam in Your #GooogleAnalyticsClick To Tweet

Analytics Spam Blacklist (Crawler and Ghost).

I will keep this list updated. You can keep it as a reference in case you find any suspicious traffic in your Analytics.

Crawler Spam List / referral / referral / referral / referral / referral
oldfaithfultaxi / referral / referral / referral lifehacĸ referral / referral / referral / referral (editorial note: the owner of this site was not aware that his site was used as spam, he already reported the persons behind this, he also complained to PayPal and was refunded)

Referral Ghost Spam

 LIST OF LATEST referral GHOTS SPAM / referral / referral search shell referral page title / referral
secret.ɢ / referral / referral / referral / referral / referral 
scanner-[name].top / referral compliance-***.top / referral with page tiltle
MULTIPLE combinations (30+) of fake keywords with at the end  
Check full historical list of ghost spam (300+)

Organic/Keyword Spam

LIST of latest keyword spam
multiple keywords ending with multiple search terms ending with

Language spam

List of latest Language Spam
Secret.ɢ You are invited! Enter only with this ticket URL. Copy it. Vote for Trump!
"Vitaly rules google ☆*:。゜゚・*ヽ(^ᴗ^)ノ*・゜゚。:*☆ ¯\_(ツ)_/¯(ಠ益ಠ)(ಥ‿ಥ)(ʘ‿ʘ)ლ(ಠ_ಠლ)( ͡° ͜ʖ ͡°)ヽ(゚Д゚)ノʕ•̫͡•ʔᶘ ᵒᴥᵒᶅ(=^ ^=)oO" search shell is much better than google!
Google officially recommends search shell!
Language spam: "Congratulations to Trump and all americans" another message supporting Trump - - - All World Watching These Videos
LIST LEGITIMATE SITES TARGETD BY SPAM / page title / referral / referral / referral  / referral
Recent Referrer SPAM List / referral / referral / referral / referral / referral / referral / referral / referral referral
Recent Keyword, Page and now Language Spam List
Language: Language: " search shell" Page title: "Vitaly rules google"
Page: / Page: / Keyword: cdn
Keyword: MULTIPLE combinations using ""
Keyword: MULTIPLE (30+) combinations ending with
Be the first to comment :)