How To Block Specific Traffic Source From My Website Using CloudFlare

Block Specific Traffic Source From My Website Using CloudFlare


We all love watching our website grow and the traffic we get, but while we are growing we may see some unusual visits from a specific source (referral traffic) that is badly impacting our site SEO ranking and analytics. Generally, they increase your site bounce rate which is negative for every website to rank higher.

Why Do We Need To Block Referral Spam?

Traffic from a referral can be extremely valuable but spam referring can take your whole strategy down.
Sometimes, the website owner gets over-excited about those unusual views without understanding how harmful it can be if they don't filter out those spam referrers. They are not only limited to increasing your website's Bounce Rate but also overload your server. Which may lead to poor user experience due to slow page loading.

The spammy referrer usually does these, so that their site shows up into your Google Analytics often in a hope that you will visit their site being interested.
They Mislead your analytics and throws you out of your business strategy. 

How Do We Know If A Referral Traffic Is Spam Or Not?

If you see traffic from an Odd Website (I can be a Traffic Exchanger site too) and you don't recognize it anyhow, then it might be spam traffic. Again, if you suddenly see that views from a site increase abnormally then it might be spam traffic
Follow The Steps To Find Out Spam Referral Traffic Source:
  1. First of all, Log in to your Google Analytics Account
  2. Find Out Spam Referral Traffic Source Using Google Analytics
  3. Then, click on Acquisition and select All Traffic and then go to Referrals :
  4. We need to weed out only the spam ones. So, Scroll Down and check for those sites you suspect and that increasing your bounce rate to 100% with an average session duration of 00:00:00
Sometimes, we can easily detect that which one is spam but sometimes when it comes from some reputed website it is a matter of great regret.
We can use Google Analytics To filter them but we are going to use CloudFlare Instead in this article.
So, let's get started...

Blocking Traffic From A Specific Source Using CloudFlare:

First of all, make sure that you are using CloudFlare on your website. CloudFlare helps you to protect your website and your visitors to hackers. You can also boost your website speed by using CloudFlare Rocket Loader, Brotli, and minifying your codes.

If you are already using CloudFlare then,
Log in to your account and follow these steps:
  1. Select your website and go to the 'Firewall' tab
  2. Go to the 'Firewall rules' section and click on 'Create a Firewall rule' button
  3. Give a name to your Firewall rule (e.g. Spam Referrals Filter)
  4. In the 'Field Name' select 'Referer'
Now, Choose 'Operator' as you need. To understand the operators check this:
  • Equals: when the value matches exactly the action triggers
  • Does Not Equal: when something is other than the value the action triggers
  • Contains: When a value exactly or partially contains the value the action triggers
  • Does Not Contains: When a value does not exactly or partially contains the value the action triggers
If you want to block only a link, not the whole domain then you can use 'Equals'. 
We will use 'Contains' to block the domain with all its pages and subdomains.

Additionally, you can click 'or' button and repeat the same process to block more than one URL/domain as shown below:
Blocking Traffic From A Specific Source Using CloudFlare Firewall Rules





Make sure you have selected the 'Block' option. Then save the Firewall rule by clicking on the 'Deploy' button.

This will block that domain/URL from accessing your website. Instead of sending visit from those source to your site CloudFlare will show than a page like this:
Blocked By CloudFlare Firewall Rules


Whenever you need to block another website via Cloudflare, simply go to your previously created rule and add another domain clicking on the 'or' button.

Congrats!

You have successfully Blocked traffic from a specific source from your website.

Thanks For Allowing Us To Help You :)
If you are confused or want to know something, then let us know in the comment box, we will reach you as soon as possible. Don't Forget To Subscribe our Newsletter, YouTube Channel, and Like Our Facebook Page To Keep Updated With Awesome Things. Follow us on Twitter to stay updated with the latest news & changes.

Comments

You are always welcome to ask us and share your ideas
We try to bring to you the most amazing learning site for tech enthusiasts and thus work to teach you the basic and internal parts of software management, website and apps making, programming, etc. Programming and technical explications are the main points and we hereby provide you the requisite basic and a clear idea about programming and other technological interests. Our main purpose is to make you fluent in programming languages.

Subscribe