Skip to content

Fight Referrer Spam and Ghost Referrer Spam

StockSnap / Pixabay

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

Order allow,deny
Allow from all
Deny 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:

 

Dieser Beitrag hat 0 Kommentare

Schreibe einen Kommentar

Deine E-Mail wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

An den Anfang scrollen