I have written an article to block darodar.com ilovevitaly.com econom.co referral traffic. Now the new one i’m getting hits on my blog is ilovevitaly.co . Its the same as previous ilovevitaly.com spam but as we have blocked it spammers did changed the domain name to ilovevitaly.co , but don’t worry we can also block ilovevitaly.co.
In this article i’m going to show you all the methods of blocking these spam traffic. You have already blocked previous darodar and econom with the .htaccess , javascript and PHP code.also I have written to filter them out with analytics. Here are some articles I have previously written.
I have seen many people talking about that these spammers are using analytics code to show up in analytics but that’s not true. I have seen many websites getting referral traffic which is using other analytics like yandex and piwik. which displays the same referral links. If you want to filter them then use the below link which will guide you to create analytics filter to block spam traffic.
So now lets block ilovevitaly.co with all the method.
1 .htaccess code
You need to have access to your .htaccess file to use this method. Some of the website owners may be using wix , squarespace to create website then they need to add javascript code or they can filter out this spam traffic with analytics filters. Which is given below.
SetEnvIfNoCase Referer ilovevitaly.co spamlink=yes
Order allow,deny
Allow from all
Deny from env=spamlink
2. Javascript code
If you want to use javascript code then you have to add this script between your head tag. This code simply redirects the traffic coming from spam referrer to another website so that you can prevent them from showing up in your anaytics.
<script type='text/javascript'>
var blocklink = ['http://ilovevitaly.co'];
for (var b = blocklink.length; b--;) {
if (document.referrer.match(blocklink[b]))
window.location = "http://google.com/";
}
</script>
3. PHP code
You will have to add this code in your header.php file inside the theme folder you are using. You need to paste the code between header tag.
$blocklink = ['http://ilovevitaly.co'];
foreach ($blocklink as $value) {
if ($_SERVER['HTTP_REFERRER'] == $value)
header('Location: http://google.com/');
}
If the above code does’t work and if you get any error then add below code. This is just a javascript code which is added inside head tag with the help of php.
<?php
echo"<script language='javascript'>
var blocklink = ['http://ilovevitaly.co'];
for (var b = blocklink.length; b--;) {
if (document.referrer.match(blocklink[b]))
window.location = "http://google.com/";
}
</script>
";
?>
4. Using analytics filter
If any of the above method doesn’t seem to work then use analytics filter to avoid them being showing in your analytics results. Read below article which guides step to step to create analytics filter to block any spam traffic.
Please share and comment for any other help.