Wednesday, February 10, 2016

Blocking Ghost Spam in your Google Analytics Referral Sources

Using filter in Google Analytics to prevent Ghost Spam

As we learned in the post about What is Ghost Spam?, Ghost Spam is something that hits your Analytics but not your actual website. It works by garnering traffic from people that see the spam link in their Analytics reports, don't realize it's spam, and click on it to see who they are.

Important things to know:


1. They are not hurting your actual site. They are report spam only.
2. They do not impact your SEO ranking. Google doesn't access Analytics when making decisions about organic or paid ad ranking.
3. They are not attacking your reporting because you are a small or medium business. Everyone is equally susceptible to this type of Ghost Spam. Larger sites usually have someone on staff who have taken steps to block it from the reporting. Also, larger site numbers are much less skewed by these bogus numbers. Small and medium business value pretty much every page view. The percentage is much larger to us.

Good news is that you can take steps to use filters in your Analytics that will block these numbers.


This project is mildly geeky on the "how hard is this?" spectrum. You should be able to follow the steps pretty easily BUT you need to have a handle on your site traffic for the past several months and also know your domains and vendor domains (if any).

Some (many) people (I am still not sure why) choose to block the spam using exclusion filters. It's a fast an easy fix BUT you have to be on it all of the time. You need to be aware of new sources and would have to add the to list weekly to prevent new spam from being reported in your Analytics traffic numbers. I find this to be a waste of time and much less effective than using an a inclusion filter that only reads valid host sources. (essentially your site name and any vendors that you use on your site).


If you would like to move forward adding a filter to your view, I will walk you through it below.

DO NOT skip the step where you add a second "view" in your Analytics. Every time you play with settings you run a risk of losing your history. Losing history is much worse than having some spam numbers in your reports. Adding a second "view" allows you to keep a main view that is unaltered and is always there for you.

To make a second view in your Analytics:



  1. Sign in to Google Analytics
  2. Click Admin tab and "account and property" to which you wish to add the view .
  3. In the VIEW column, click the drop down menu and then Create new view.
  4. Select either Web Site or App. We'll discuss in future posts what the difference is on this. You want Web Site. 
  5. Enter your new view name. I usually name this view something very obvious like "Site traffic without spam".
  6. Select the Reporting Time Zone.
  7. Click Create View.
Now when click back on home in Analytics, there are two views two choose from, All Web Site Data and your new one.
Using filter in Google Analytics to prevent Ghost Spam


The first is your unaltered view and is always there for you with your history. The second view will get the filter applied to it.


Now we will create your filter. You need to find a list of your valid hostnames. This will include your site and any vendors that need access to or that are linked to from your site. Don't be Ghost Spam tricked...they use names that you have heard of before like Google.com and Amazon.com. Unless Google or Amazon is a vendor of yours, this is most likely spam.
To create this filter you will need to get a list of hostnames that are valid for your site.
in Analytics go to your original view in Analytics and then:


  1. Reporting Tab
  2. Audience on the left side
  3. Click drop down next to Technology and select Network
  4. At the top of the report, click on Hostname
  5. Adjust your date range to at least 6 months ago through now. 
Using filter in Google Analytics to prevent Ghost Spam

This gives you a list of hostnames, including the ones that are spam. Now you can make a list of all of your valid hostnames. Again, these are yours and any vendor or services that you use.
  • yourmaindomain.com
  • blog.yourmaindomain.com
  • es.yourmaindomain.com
  • payingservice.com
  • yourvendor.com
  • anotheruseddomain.com
For small to medium business sites, the list of hostnames usually contain the main domain, subdomains and vendor domains. When you are confident that you have your list of valid hostnames, then its time to create a "regular expression".

This is a string that includes all of your VALID hostnames separated by a straight up and down line. |  (it's usually under the backspace on keyboards).
The line means "or". Also, there's no need to add subdomains if you don't want to. Your main domain will catch them all. 

yourmaindomain\.com|vendordomain\.com|payingservice\.com|translatetool\.com|anyotherdomain.com

Then create a Custom Filter.
Go to Admin tab, View (on the right) and make sure the drop down box is the NEW view that you created for this. 
Using filter in Google Analytics to prevent Ghost Spam

Click the red +filter button.
Using filter in Google Analytics to prevent Ghost Spam

1. Type your filter name. Make it something that is clear and makes sense. Ghost Spam Filter usually works for me.
2. Choose custom.
3. Choose INCLUDE (or else you'll be only blocking real info instead of spam).
4. Copy paste your carefully crafted "regular expression".
5. Click "verify this filter" to show what your Analytics report will look like with the new data filter in place. Whether you think it's right or not is a gut call here. You should have enough of a feel for your traffic to know if this is real. If you don't have that gut feel, I recommend aborting this mission for a month or two until you know your numbers better.
If it's good, then save it, set it to save. You can make sure at this time that the filter is on your new "view" and not your "all web site data" view.
And that is that. You have applied a filter to a special view in your Analytics that will allow you to read numbers that only apply specifically to your site.
You have also excluded any new spam that comes around because rather than blocking spam one by one, you've excluded all of them at once. Even new ones. Please remember that every time you add a tracking code to a new service/vendor's page you'll need to make sure they are included in your "regular expression".
Wow you have learned a lot today. If you have any questions, please let us know. Also... why don't you follow us on Facebook to get notified of new posts as they occur? We'd love to have you in our tribe : )

No comments:

Post a Comment

Thank you for your comments. We all get better when we share information.

Amazon Deals