Many people have asked how we can get rid of referral spam in Google Analytics. We normally see this under Reporting > Acquisition > All Traffic > Referrals.
If you see source such as free-share-buttons, buttons-for-your-website, best-seo-offer, hulfington-post, etc and the bounce rate corresponding to this websites is 100%, then it is a referral spam.
This could provide inaccurate analytics and you could see that the traffic is increasing to your website but unfortunately it is not at all legit but bot hits.
Solution:
The solution is to add the following code in the .htaccess files:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
## STOP REFERRER SPAM ## RewriteCond %{HTTP_REFERER} ^([^.]+.)*?4webmasters\.org [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?anticrawler\.org [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?addons\.mozilla\.org [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?bestwebsitesawards\.com [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?best-seo-solution\.com [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?blackhatworth\.com [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?buttons-for-website\.com [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?econom\.co [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?darodar\.com [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?hulfingtonpost\.com [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?googlsucks\.com [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?humanorightswatch\.org [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?ilovevitaly\.com [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?7makemoneyonline\.com [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?o-o-6-o-o\.com [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?priceg\.com [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?social-buttons\.com [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?semalt\.com [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?smailik\.org [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?simple-share-buttons\.com [NC] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?youporn-forum\.ga [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?buy-cheap-online\.info [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?free-share-buttons\.com [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?Get-Free-Traffic-Now\.com [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?best-seo-offer\.com [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?buttons-for-your-website\.com [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?theguardlan\.com [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?hulfingtonpost\.com [NC,OR] RewriteCond %{HTTP_REFERER} ^([^.]+.)*?torture\.ml [NC,OR] RewriteRule .* – [F] ## STOP REFERRER SPAM ## |
The code consists of the URLs that I came across in my Google Analytics. If you discover some more URLs please share it in the comments below:
Those dang bots are everywhere on the Internet it seems, but having those spam bots can throw your stats off.
I run many of my sites behind Cloud Flare and it seems to me that the analytics for bots and visitors is much higher than in Google analytics. But the good news is, is that Cloud Flare prevents many of the spam bots from crawling. It also helps that the server I run these sites on also adds the htaccess code automatically if you install their version of optimize wordpress.
However, for those sites that I do not have running behind Cloud Flare, I have taken your list and added them to the htaccess as a prevention measure. When I looked at Google analytics, there were only a couple spam bots there, but might as well keep them all out. So thanks for this bit of info Keyur.
Thanks Dawn.
I had no idea if the CDN were able to block those spam bots but that’s something I have learned today. If some of the bots or spam referring sites you come across in the future are not in the list, feel free to add it in your .htaccess file and also in the comment here so that I can keep this code updated.
Cheers
Meddling around the codes is one area that I hv yet to get accustom and confident with, Keyur. Just wonder, why do they want to do this?? Referring to the bots activities. Cheers.
You may have heard of getting 1000000 hits for just $10. This is where this spammers use those autobots to send the hits through. And we unfortunately become their victims. They send the hits to the server IP which record the hits on our servers and because they are not real visitors it shows the bounce rates to be 100% which messes our analytics.