(424) 259-1791

Guide to Hiding Bots and Spammy Referral Data in Google Analytics

There has been a lot of super spammy referral data hitting sites lately in drones.  It’s annoying because it messes up your data and makes you think momentarily that things are looking better than what they truly are. It’s very important to track referral data correctly so that you can measure the success of your campaign and know exactly where those clicks are coming from.  I started doing a lot of research lately on how to hide this spammy referral data from entering my analytics moving forward.  There are ways to block it completely which i’ll get into later but the steps are a bit more technical.  For now, here’s how I managed to block any incoming intruders from ruining my Google Analytics data.

I recently logged into my analytics to find one of my new sites that just launched, showing large spikes on the overview.  I haven’t done anything to promote this site yet so I knew something was wrong.  This is what spam looks like from a broad perspective.  It’s not uncommon to see spikes in traffic on established sites but on a new site like this it’s abnormal and worth investigating.


Sure enough the referral data showed a lot of spam:


To find this data go to Acquisition > All traffic > Referrals

These are a few of the more common sites that are spamming sites as of late.  Go ahead an copy down all the sites that look like they have zero relevancy to your site and paste them into a notepad.  You’ll use this data later.

Now go to Admin > All Web Site Data > View Settings > Filters


Name the filter “Spam” so you know exactly what you are filtering in case you have other filters in place.  Click on Custom > Campaign Source and you’ll see a box called Filter Pattern.  This is where you paste in the websites you copied into your notepad earlier.  You must enter them into the box in this format with a “|” in between them:|||


Once you’ve input the data into the filter pattern click on Verify this filter:


Once this is done click on Save.  Remember, this is only hiding future data on bots you’ve specified in the filter pattern.  This filter won’t erase the historical data on bots in your analytics, only future data.  Also, you’ll need to keep adding websites to this filter to make sure nothing spammy is showing up in your referral data.  As soon as you notice a new one add it to your spam filter.

If you want to stop spam data from hitting your site altogether, use these steps:

Step 1: Block referrer bots

Access your .htaccess file and add this code:
Screen Shot 2015-04-10 at 10.36.16 AM

This will block all http and https referrals from and all the subdomains of “” as well.

Step 2: Block the IP of bots

Access your .htaccess file and add this code:

Screen Shot 2015-04-10 at 10.39.08 AM

Step 3: Bot Filtering checkbox in Google Analytics


Google does a decent job of keeping up to date with which bots are causing issues with peoples data.  Of course this isn’t foolproof but its a good start.  You can find this under View Settings.

If you’re using WordPress you can try these plugins:



These allow you to blacklist certain domains.  They also keep a list of spammers and filter those out for you so you don’t have to keep your filters up to date all the time.  That kind of maintenance can become a serious headache if you have a lot of sites.

Even George Bailey is fed up with spammers:

Hope this information helps clean up your Google Analytics data!


Comments are closed.