Referrer spam is a growing issue that website owners need to be aware of. In simple terms, referrer spam is traffic generated by bots that imitate referral links. These bots are designed to make their domain appear in your website analytics, with the goal of tricking you into visiting their site. 

Not only does this result in inaccurate reporting of website data, it can also cause overloading of servers. At Blooming Web Medi , we regularly see clients who are surprised to learn that their website traffic is not as high or as valuable as they believed due to referrer spam.

In order to protect your website from referrer spam, there are a 3 effective ways to block it.

Method 1: Block Spam Referral Traffic through .htaccess file

Blocking spam referral traffic is most effectively accomplished through a .htaccess file. This method allows you to block spammy visits by domain or IP address. For example, if you want to exclude domains like Semalt and buttons-for-website.com, you can add the following command to your website’s .htaccess file:

SITE REFERRER BANNING

RewriteCond %{HTTP_REFERER} semalt.com [NC,OR]

RewriteCond %{HTTP_REFERER} buttons-for-website.com [NC,OR]

RewriteCond %{HTTP_REFERER} seoanalyses.com [NC]

RewriteRule .* – [F]

Method 2: Apply Google Analytics Filters

The second method of blocking spam referral traffic is through applying filters to your Google Analytics account. Applying filters is great for reporting purposes, but it won’t prevent spam bots from visiting your website. 

The filters will simply exclude visits from the Google Analytics data. However, for best results, you must block these domains through your website’s .htaccess file. If you’re looking to exclude traffic data from certain IP addresses, here’s a quick guide:

  1. Login to your Google Analytics account.
  2. Click Admin.
  3. Click All Filters.
  4. Give the filter a name.
  5. Select Predefined.
  6. Select ‘Exclude’, ‘traffic from IP addresses’, and ‘that are equal to’ in the boxes below.
  7. Enter the IP Address that you wish to exclude, and then click Save.

Method 3: Block Spam Referral Sites through cPanel

Finally, you can also block spam referral sites through cPanel. Here are the steps to follow:

  1. Login into your hosting cPanel.
  2. Go to Security section and click on IP Deny Manager.
  3. Enter the IP address or domain name that you want to block.
  4. Click on Add.

That’s it! Now check your Google Analytics 

the next day to ensure that you no longer see spam referral traffic in your reports.

By implementing these methods, you can protect your website from referrer spam and ensure that your website data is accurate and reliable.