Published May 12th, 2020 by Editorial Team

How to Exclude Ghost Spam in Google Analytics for Better Marketing

Have you ever noticed random traffic spikes in your Google Analytics reports? You might have a ghost spam problem.

In this article, we’ll show you exactly what to do in Google Analytics to exclude ghost spam and take back control of your data.

Fair warning: this article gets a bit technical. If getting into the weeds of your analytics scares you, there are many SEO experts well-versed in Google Analytics that would be able to help you.

Ready to dive in? Let’s start by figuring out what ghost spam even is.

What Is Ghost Spam?

Ghost spam, also known as referral spam, infiltrates your Google Analytics server by accessing your Google Analytics tracking code. This happens either by randomly generating the right code using the pattern “UA-XXXXXX-Y” or from getting access to your code from a third-party website.

Once it has your code, the crawler never actually accesses your site but uses some technological magic called Measurement Protocol to skew your Google Analytics data.

Types of Ghost Spam

Spam in Google Analytics is either ghost spam or crawler spam. Ghost spam is so named because it never actually interacts with your site at all.

Using Measurement Protocol, people can send data directly to Google Analytics’ servers and leave fake site visits.

Let’s take a closer look at the different types of ghost spam you might encounter in Google Analytics.

Ghost Spam Referrers

Ghost spam referrers show up in your referral traffic report. It looks like real traffic, but it’s not hitting your servers. It just shows up in your Google Analytics reports.

ghost spam referrals google analytics

To find this report in Google Analytics, go to Acquisition > All Traffic > Referrals.

How to Recognize Referral Spam

Fake referrals aren’t hard to recognize, fortunately. Be on the lookout for:

  • 0% or 100% bounce rates
  • 0s Average Session Duration
  • 0% New Sessions
  • Landing page is “/”

Ghost Spam Pageviews

Ghost spam pageviews show up as fake pageviews with fake URLs that the spammers want you to visit.

ghost spam pageviews google analytics

You can find this report in Google Analytics by going to Behavior >  Site Content > All Pages.

How to Recognize Pageviews Spam

Pageviews spam is really easy to identify since it shows up as pageviews to pages on your site that don’t even exist!

Ghost Spam Events

Like referrals and pageviews, events spam shows up in your Google Analytics reporting, but no actual event has taken place on your site.

ghost spam events google analytics

This report is in Google Analytics. Just go to Behavior > Events > Top Events.

How to Recognize Events Spam

Events spam is easy to recognize because it will show up as events you haven’t set in Google Analytics.

What’s the Point of Ghost Spam?

You may have noticed that ghost spam doesn’t do anything except skew your reporting.

So, why do spammers even bother with ghost spam?

Clicks. Traffic. Money.

Ghost spammers use this tactic on thousands of sites. If even 1% of those sites click on the strange links that are showing up in their analytics reports, that’s a lot of potential traffic and eyes on whatever it is the spammer is promoting.

Or, it could be a simple desire to deploy a malicious script.

Most common, ghost spammers are trying to achieve one of these goals:

  • Promoting a page
  • Getting your email address
  • Selling you something
  • Trying to get you to insert a script on your site
  • Redirecting you to an online store in the hope that you’ll buy something and they’ll get a commission

As you can see, there are several ways spammers can benefit from something as simple as showing you fake referrals, pageviews, and events for your site.

Why Should I Worry About Ghost Spam?

You may be wondering why you shouldn’t just ignore ghost spam and go on about your life. After all, if you’re not clicking strange links in your reports, does ghost spam even matter?

Yes, it does.

If you’re using a tool like Google Analytics, you’re using it for a reason. Probably, that reason is that it helps you make data-driven marketing decisions.

But if your reports are filled with misleading data, how much good is it doing you?

Not much.

In fact, relying on inaccurate data can lead to bad marketing decisions. And that could severely impact your bottom line.

Pro Tip: In the market for an analytics tool? Check out our list of the best web analytics software!

Google Analytics: Exclude Ghost Spam

Now that you know what ghost spam is and why you should care about it, let’s talk about how to get rid of it.

We’re going to walk you through a series of four steps that will help you tackle ghost spam so you can take back your reports.

Step 1. Make a Copy of Your Analytics View

Before we start adding filters, let’s first create a copy of the current Analytics view.

To do this, go to the Admin tab, and in the right-hand column click on View Settings.

google analytics admin view settings

Next, click Copy View.

google analytics admin copy view

Give your new view a unique name and click Copy View.

google analytics admin name copied view

Now you have a backup of your current Analytics view in case something goes wrong.

Step 2. Filter Hostnames

Our second step to excluding ghost spam in Google Analytics is to filter hostnames from your reports.

Go to the network report in Google Analytics (Audience > Technology > Network) and choose Hostname as the primary dimension. Choose a date range of one month.

google analytics hostnames report

From the screenshot above, you can see that we only need to include for this view. Please note that you may need to include more than one hostname.

Now it’s time to create and apply our filter. To do this, go to Admin and click on Filters. Then, click + Add Filter.

In our example, we’re going to create a filter to include our hostname as well as a third-party shopping cart hosted on Shopify.

google analytics hostname filter

You can verify your filter before saving it to see how it will affect the data for your current view, based on traffic for the prior seven days. Once you’re satisfied, click Save.

Congratulations! You just took the first step toward protecting your reports, and subsequent marketing decisions, from ghost spam!

Note: You may need to use basic regex to create your filter. If you’re not comfortable with this, you may want to hire an SEO expert to get your Google Analytics into tip-top shape. Check out our picks for the best SEO companies to find the right one for your business.

Step 3. Filter Additional Referrer Spam

For this step, we’re going to create another filter to catch the referrer spam that our first filter won’t catch.

This time, we’re going to filter to exclude by campaign source.

google analytics additional referral spam filter

Pay attention to the filter pattern. If you need to add another spam domain in the future, you’ll add it there using a vertical bar (“|”) followed by the name of the domain and adding a backslash (“\”) before dots (i.e., “baidu\. | darodar\. | semalt\. | huflingtonpost\.”).

Step 4. Clean Out Existing Ghost Spam

Since filters aren’t retroactive, you’ll need to clean existing ghost spam from your reports separately. This is easily accomplished by using a custom segment.

In Google Analytics, go to Acquisition > All Traffic > Channels.

google analytics channels report

Click on Secondary Dimension and enter Source / Medium.

google analytics secondary dimension source medium

Next, click Add Segment at the top of the page.

google analytics add segment


google analytics add new segment

Click Conditions in the menu on the left side.

google analytics segment conditions

In the Ad Content dropdown, choose Behavior > Hostname.

google analytics behavior hostname

In the second dropdown, select matches regex.

google analytics segment matches regex

In the third box, copy and paste this string (created by Brian Clifton):

offer | free\- | share\- | mercedes | buy | cheap | googlsucks | benz | sl500 | hulfington | buttons | darodar | pistonheads | motor | money | blackhat | backlink | webrank | seo | phd | crawler | anonymous | \d{3}.*forum | porn | webmaster | flipboard | fl\.ru | m

Click the OR button and make sure that the dropdown selections match those in the first line. Then, in the new blank field, copy and paste this string:

dailyrank | 100dollars-seo | anticrawler | sitevaluation | buttons-for-website | buttons-for-your-website | -musicas*-gratis | best-seo-offer | best-seo-solution | savetubevideo | ranksonic | offers.bycontext | 7makemoneyonline | kambasoft | medispainstitute

Click the OR button again and copy and paste this string: | | | | videos-for-your-business | | video—production | success-seo | | seo-platform | | | rankscanner | |

Click the OR button one more time and copy and paste this final string: | | | | ^ |

Give your new segment a descriptive name (we’re using Clean Segment) and click Save.

google analytics enter regex strings

Now, whenever you run reports, you can apply this filter to remove spam that came in prior to creating your filters.

3 Common Mistakes When Dealing with Ghost Spam in Google Analytics

Excluding ghost spam from your Google Analytics reports is a complex task. It’s common to make mistakes or focus your energy on the wrong thing when undertaking a task like this.

Here are the three most common mistakes people make when dealing with ghost spam, so you don’t make them, too.

1. Worrying About Bounce Rates

When you start cleaning up ghost spam from your Google Analytics reports, your bounce rate is going to change.

Think about it. You’re getting rid of a lot of 100% and 0% bounce rates from ghost spam, so it just makes sense that your overall bounce rate would be affected.

Many people worry that this will have an adverse effect on their Google rankings.

It won’t.

While there are many SEO ranking factors that do impact your Google rankings, bounce rate isn’t one of them.

2. Using the Referral Exclusion List

You may be tempted to use the referral exclusion list to stop ghost spam referrals. It says it right there in the name, right? Referral exclusion.

That list is for something else entirely.

According to Google, the referral exclusion list is helpful for cross-domain tracking so that multiple sessions aren’t triggered when a visitor engages with more than one of your domains in a single session.

Another use of the list is to exclude third-party domains that refer traffic, as in the case of customers who may get redirected to a third-party page to make a payment before being redirected back to your site.

If you don’t add the third-party domain to your referral exclusion list, each time the visitor touches your site will count as a new referral.

3. Blocking Ghost Spam From .htaccess

This is probably the most common mistake people make when trying to get rid of ghost spam.

The purpose of the .htaccess file is to allow or block access to your site. Since ghost spammers don’t actually reach your site, what do you suppose happens when you make changes to this file to keep them out?

If you guessed “nothing,” you’d be right.

So, no, you can’t block ghost spam with changes to your .htaccess file. However, you could effectively block crawlers since they directly access your site. But not ghost spam.

Wrapping Up

Most of the time ghost spam is more of a harmless nuisance than an actual danger. However, if you’re using flawed data to make marketing decisions, it has the potential to be devastating to your bottom line.

By using the steps we’ve outlined in this article, you’ll be able to take charge of your data and use it to make the best choices for your business.

Not ready to jump into Google Analytics on your own? Find an SEO expert to handle it for you. Everywhere!

Reach us from wherever you are. Get the latest updates fast.


Get updates and follow
us on Facebook

Remain connected with
us on urgent updates


Access our company
profile page on LinkedIn


Copyright 2023 © Use of this website constitutes acceptance of Terms & Conditions | Privacy Policy | Legal Disclosure