Pages Menu
Categories Menu

Posted by in Online Tools

How To Block Spam Referral Traffic A.S.A.P

How To Block Spam Referral Traffic A.S.A.P


After searching for “how to stop spam referral traffic”, I decided to click which was Google’s 3rd top spot on the results page. I used that keyword because the unusual traffic surges in my Google Analytics had annoyed me for days. Since my site’s relatively new without so much marketing effort, I could freely tolerate the low to zero traffic. I can’t though for those atypical traffic referrals.

Having site referrals with 100% Bounce Rate and  00:00:00 Average Session Duration won’t help my analytics. After a few googling, I learned it was some kind of a spam referral traffic. In the image below, and a variation of which would bring in uncommon spikes in my GA quite randomly (you’d find it in your GA account’s Acquisition>Referrals)

Spam Referral Traffic

Spam referral traffic destroying one’s Google Analytics integrity


As curious as I was, I tried that website and was redirected to I didn’t know what the business of that site was, as there was nothing in there except for a couple of codes for sharing. Probably one of their reasons for distracting our attention was for us to end up visiting their site. Actually, those variations in my GA, bringing in the most number of referrals, also brought me to the same site.

Spam referral traffic redirects to

Spam referral traffic? Check your GA.


If I’d allow this to dominate my GA, then I’ll have alarming insights and further decisions for specific sets of action plans could end up totally wrong. I just can’t authorize bad leading indicators to dominate my site. Would you?

Now back to the “how”. I’m quite thankful that Jon Henshaw, Co-Founder and CEO of Raven Internet Marketing Tools, wrote the post so I could also prepare how to prevent spam referral traffic in this site. Though he has about 5-6 options on how to block spam referral traffic, I’m rewriting a couple of “hows” here to help spread the word in combatting spam referral.



Two Simple Ways To Stop Spam Referral Traffic


The first one is adding a certain code in your .htaccess file.

RewriteCond %{HTTP_REFERER} [NC,OR]
RewriteCond %{HTTP_REFERER} [NC,OR]
RewriteCond %{HTTP_REFERER} [NC]
RewriteRule .* – [F]


Especially for beginners, “.htaccess file” may sound foreign to you. Just go to your Cpanel, look for the File Manager and select which domain or add-on domain you’d like to address. Look for the Code Editor above and add the code SITE REFERRER BANNING (or you may call it SPAM REFERRAL TRAFIC BANNING) after the last </IfModule> and before # END WordPress. If you have spam referral traffic sites other than these, just add them like what I did with Jon’s code.

It should look like this.

spam referral code using the .htaccess file

Spam referral traffic blocking code at .htaccess file


Always save a copy of the working .htaccess file somewhere. There is always this tendency to copy all of those suspected domains and add-on domains in your .htaccess file, resulting to access restriction from your very own site. Just in case you’ll be unable to access your site due to “Internal Service Error”, revert to your working .htaccess file.

By the way, some scripts/codes that you’ll add to your webfiles may not work correctly because some options on the shared hosting may be disabled by default. You can only do some tests if you are subscribed to your hosting’s premium business package or equivalent. Talk to your web host support.


The other option is to create a filter in your Google Analytics.

Click the Admin>All Filters and click the New Filter. Name it whatever you want (I just named mine Exclude Spam Referral Traffic) and select the Custom under Filter Type. Fill in the Filter Pattern box with this

– darodar.|semalt.|buttons-for-website|blackhatworth|ilovevitaly|prodvigator|cenokos.          |ranksonic.|adcash.|simple-share-buttons.|social-buttons.

That’s it! You should already stop the unwanted traffic to your site after these strategies (unless there are other spam referral traffic using another domain or subdomains).

Again, thanks to Raventool’s Jon Henshaw for the post. I did both procedures as I wouldn’t like to take chances.  I guess either one or both should work.

I’ll be observing further if there’ll still be spam referral traffic spotted in my GA (the code/filter has been running for a week as of this post’s publish date). I’d be glad to update you how effective these methods are.

And if you have a better way of doing it, pls. feel free to share.

Disturbing spam referral traffic

© Rawpixel / Dollar Photo Club