back to blog

How to Remove Spam Bots from Google Analytics – and Keep ‘em Off!

You’re prepping a website report for management and there it is in brazen glory, a spam entry in your top referral sources. If you’re lucky, it’s one of the more ‘safe-for-work’ spam sources. Common Google Analytics referral source spammers include:
  • best-seo-offer.com
  • buttons-for-your-website.com
  • social-buttons.com
  • buttons-for-website.com
  • buy-cheap-online.info
  • get-free-traffic-now.com
  • simple-share-buttons.com
  • event-tracking.com
Unfortunately, there’s a growing trend of pornographic spam, which we won’t list. (Sorry.) In this post, we’ll share a little about this pain in the analytics and the two five-minute-or-less-fixes to removing this data from your reports – and keeping it off! Is Analytics Referral Spamming a Threat to You? Referral spam neither poses nor indicates a threat to your website or user data. On new and mid-trafficked websites, they can have enough weight in your numbers to alter the accuracy of your analytics data. If you rely on Analytics to build more informed decisions for your business, this is a fairly large problem. (If you didn’t catch it and just handed a list of adult website URL’s to your manager, this is a much larger problem.) Here’s how you can fix it, and keep it from happening in the future.

Preventing Google Analytics Spam

Preventing spam won’t remove spam from historical data (we cover that last) but it does go a long way in keeping it from happening in the future.

Google Analytics ‘Prevent Known Bots’ (Investment < 1 Minute)

Google understands that analytics spam is a nuisance, and takes active measures to reduce it – but those counter-measures aren’t enabled by default. By enabling this setting, you’ll prevent Google’s known bots. It doesn’t stop all spam, as these bots seem to be a step ahead, but it will go a long way in reducing the spam that’s already been ‘discovered.’ SelectView SettingsFrom Your Admin menu:   Then scroll and select Exclude all hits from known bots and spiders.’ Be sure to continue to scroll down and Save your settings.

Google Analytics Bot Filters (Advanced) (Investment < 5 Minutes)

While best practice is to never filter data from your primary view, I think we can all agree that this spam will never provide much use. This countermeasure sets Google Analytics to exclude bots based on a set of common features. We’ve spent a few weeks tweaking this Google Analytics regex bot filter over dozens of analytics accounts so you don’t have to. Like any spam filter, the goal was to filter as much of the bad as possible without over filtering. From your Admin menu’s Account column, select All Filters, then + New Filter.   Name the filter the most uncreative name you can think of. It may be months until you come back to this section of Analytics, afterall. Select to create a Custom filter type to Exclude. For the Filter Field, select ‘Referral‘ and paste the following as a Filter Pattern. semalt|button|traffic|seo|buy|free|(po*rn)|(su*ck)|(event\-tracking)   Finally, add the desired Google Analytics views you would want to filter bots from, and Save your settings. Now with your best Scarlett O’Hara fist shake, proudly declare ‘As God is my witness, I’ll never see bots in my Analytics again!’ Just like your email inbox, you’ll probably get a few creative spam hits now and again, but this filter will take care of the lion’s share.

Removing (Rather, Hiding) Google Analytics Spam

Prevention is key, but if you need a spamless report today, Google Analytics’ advanced segments are here to help. By using a segment, we’ll use the same filter we setup for prevention to hide that traffic from our reports. Once enabled, this will filter your Analytics view, but it will not remove the spam from your historical data. If you’re logged into Google Analytics, clicking the link below will install our preconfigured Analytics filter for you to any Analytics view(s) you select. https://www.google.com/analytics/web/template?uid=HTa72cZ1RGuM24O3vrzrPA Once installed, click ‘All Sessions’ above any graph in Google Analytics, and select ‘wedü’s Bot Filter.’ So long as this filter is active, all reports and exports will exclude a vast majority of spam traffic. Need more help with using your data to improve marketing? Subscribe for future updates or contact us for a more immediate need.    
Ready to get started?

It seems like you're ready to do more. This is why we have to meet.