Google Analytics Referral Spam Filter Wizard

If you have a Google Analytics account you’ve probably recently been frustrated  by the amount of spam showing up with bogus referrers, events, and other junk data. Referral spam in web analytics reports has been around for a long time, but it only started showing up in Google around the end of 2014. Google is working on the issue and seems to be blocking some of it, but new spam continues to crop up. This method will stop current spammers, and can be re-run again in the future as new spammers arise.

Start Referral Spam Filter Wizard

This tool will automatically insert filters to block new referral spam.
It uses two different methods in combination:

1. Blocking analytics calls from sites other than your own (or other hosts you select, the tool will walk you through the sites calling your GA).
This eliminates most of the so-called “ghost” referrals where your site was never involved in the measurement calls.

2. Explicitly blocking other spammers that get around the hostname-limitation method, either by actually hitting your site or by forging the hostname in a measurement call.

If you already have existing spam filters these new filters should not conflict with them.


What method do you use? What spam hosts are blocked?
I use a hostnames allowed list as well as a blacklist, which means most spammers are blocked before ever getting into your reports and the filters do not need to be updated frequently. If you run your tracker on a large number of different hosts this method will not work.

I’ve gotten the list of spam hosts from spam referrals I’ve observed as well as a by the definitive guide to removing referral spam by Mike Sullivan at Analytics Edge.  Also many thanks to Mike for helping me test and improve the process! Mike’s article provides great detail about how the process works and why.

I’ve added the filters, but there’s still spam in my account.
Is it old spam?
The filters will stop new spam referrals from coming in, but they can’t filter out data already in your account. To exclude data already in your account you will need to use a segment to hide that data.

While using the tool you will be prompted with links to import a segment that will allow you exclude that data. If you’ve already inserted the filters and want just the segment it is available to import from GA solutions gallery here,
simply replace myhostname\.com with your domain.

Is it new spam?
New spammer that get around hostname filtering do come up from time to time. If the filters were working but now have some new spam you may need to update the filter. Simply run the tool again and it will update your existing filters assuming you did not change their name.

I added the filters, and now I’m missing traffic!
Did you whitelist all the domains you use?
While using the tool you will be presented with a list of domains receiving traffic. Any domain that was not included automatically (by your property configuration) or explicitly will not be included in your reports. In the case of I generally advise NOT including it in your whitelist even though it could include some legitimate traffic since it also may include a lot of spam.

Do you run your analytics on many different domains?
This method won’t work for sites that use their tracker on a large number of different domains that can’t be enumerated into a whitelist. For those people I’d recommend trying Simo Ahava’s Spam Filter Insertion Tool, which doesn’t use hostnames but has a large list of spam domains to block.

Is it safe to authenticate this tool with Google?

When running the tool you will be prompted to grant access to this tool to edit your analytics account. We don’t save any of your data on our side, not even the names of the domains you added the filters to. We count how many views have run through it to keep track of total usage but that’s all. Additionally once the tool has been run it is done editing your account, so at that point you could remove our access.

12 Responses to “Google Analytics Referral Spam Filter Wizard”

  1. Fatal error: Uncaught Error: Call to undefined function ereg_replace() in /usr2/www/html/ Stack trace: #0 /usr2/www/html/ the_commenter_link() #1 /usr2/www/html/ custom_comment(Object(WP_Comment), Array, 1) #2 /usr2/www/html/ Walker_Comment->start_el('', Object(WP_Comment), 1, Array) #3 /usr2/www/html/ Walker->display_element(Object(WP_Comment), Array, '5', 0, Array, '') #4 /usr2/www/html/ Walker_Comment->display_element(Object(WP_Comment), Array, '5', 0, Array, '') #5 /usr2/www/html/ Walker->paged_walk(Array, '5', 0, 0, Array) #6 /usr2/www/html/ wp_list_c in /usr2/www/html/ on line 63
    WordPress › Error

    The site is experiencing technical difficulties.