skip to Main Content

Fight Referrer Spam and Ghost Referrer Spam

Referrer Spam is a rather new but annoying way of spamming. Useless referrers call your website and therefore spam your analytics data. You can see if your site is spammed if you experience an unusual rise in visitors in your Google Analytics reports. There are mainly two different types of referrer spam. On is about crawlers really visiting your site causing unwanted traffic. The other type is just random busting of Analytics IDs. Those traffic does not even your website. Your Analytics IDs is just randomly chosen.

Crawler spam

Crawler Referrer Spam is the most traditional type of spam. It is about bots that randomly crawl the web and therefore actually visit your site. They usually ignore all rules like robots.txt or meta values. While ghost referrer spam can only be stopped with filters inside of Google Analytics, it is recommended to additionally block crawler spam via the .htaccess file as well.

Block malicious crawlers in your .htaccess

Here is how to properly block spammy crawlers in your .htaccess file. Simply add these lines on top of your .htaccess file to block most recent spam crawlers.

Note: This will not work with ghost referrer spam!

SetEnvIfNoCase Referer blackhatworth.com spam=yesSetEnvIfNoCase Referer http://blackhatworth.com/marketing/lounge/730430-apple-com-analytics-referral-traffic.html.com spam=yesSetEnvIfNoCase User-Agent blackhatworth.com spam=yesSetEnvIfNoCase User-Agent blackhatworth.com/marketing/lounge/730430-apple-com-analytics-referral-traffic.html spam=yesSetEnvIfNoCase Referer priceg.com spam=yesSetEnvIfNoCase Referer hulfingtonpost.com spam=yesSetEnvIfNoCase Referer semalt.com spam=yesSetEnvIfNoCase Referer bestwebsitesawards.com spam=yesSetEnvIfNoCase Referer cenoval.ru spam=yesSetEnvIfNoCase Referer buttons-for-website.com spam=yesSetEnvIfNoCase Referer darodar.com spam=yesSetEnvIfNoCase Referer o-o-6-o-o.com spam=yesSetEnvIfNoCase Referer simple-share-buttons.com spam=yesSetEnvIfNoCase Referer lomb.co spam=yes SetEnvIfNoCase Referer lombia.co spam=yesSetEnvIfNoCase Referer econom.co spam=yesSetEnvIfNoCase Referer kambasoft.com spam=yesSetEnvIfNoCase Referer lumb.co spam=yesSetEnvIfNoCase Referer 7makemoneyonline.com spam=yesSetEnvIfNoCase Referer ranksonic.info spam=yesSetEnvIfNoCase Referer savetubevideo.info spam=yesSetEnvIfNoCase Referer see-your-website-here.com spam=yesSetEnvIfNoCase Referer ranksonic.info spam=yesSetEnvIfNoCase Referer Iskalko.ru spam=yesSetEnvIfNoCase Referer 4webmasters.org spam=yesSetEnvIfNoCase Referer best-seo-offer.com spam=yesSetEnvIfNoCase Referer buttons-for-website.com spam=yesSetEnvIfNoCase Referer buttons-for-your-website.com spam=yesSetEnvIfNoCase Referer social-buttons.com spam=yesSetEnvIfNoCase Referer free-social-buttons.com spam=yesSetEnvIfNoCase Referer fiverr.com spam=yesSetEnvIfNoCase Referer free-share-buttons.com spam=yesSetEnvIfNoCase Referer sharebutton.to spam=yesSetEnvIfNoCase Referer best-seo-solution.com spam=yesOrder allow,denyAllow from allDeny from env=spam

Ghost referrer spam

This type of referrer spam is more complex. It is called ghost spam, cause the referrer-servers never actually visit your site. Those spam bots just take your analytics ID (or even guess it randomly) and use it to spam your account with false data. So you even might find websites as your top pages in your account that basically do not even exist (at least they were not intended to exist). They use the Google Measurement Protocol, which allows developers to send data directly to Google Analytics Servers. This is a major flaw in Google Analytics and urgently needs to be fixed.

Here is a way to fix it for now. The idea is to simply allow data ONLY from hostnames where your Google analytics ID is actually really used. This should be default! And I really don’t get Google for not implementing a basic fix for all analytics users. The problem with this solution is just that you have to manually create those filter for any of your analytics properties. This can be a pain in the hand.

Block bad referrer hostnames from spamming your statistics in Google Analytics with filters

First of all you should enable Google Analytcs basic anti spam mesaures to exclude known spam bots from affecting your statistics:

  • Open your Google Analytics acount and visit the settings area of the affected property
  • Check the option that reads “block known spam bots”

To remove the ghost referrer spam for future visits you need to first get a list of valid hostnames for the affected property and put it into the following REGEX  format. If your domains are example.com and example1.net just put these like:

example.com|example1.net

Note: You dont need to add subdomains like “www.”

Then add a filter with that REGEX:

  1. Visit the “Admin” tab and select the View where you want to apply the filter
  2. Select “New Filter”
  3. Select “Create New Filter”
  4. Select “Custom” as “Filter Type”
  5. Choose Include and select “Hostname” from the dropdown
  6. Finally, paste the REGEX that you build with your valid hostnames in Filter Pattern.

Note: This only works for future data! If will not clean your historical data!

More technical information about this topic:

 

Back To Top