Referrer spam

I was getting a lot of referrer spam on one of my websites using Google Analytics, so I switched to Piwik. After a few months spam-free, I’m starting to see a few spam visits show in my logs. Some from ‘’ Is there anyway to combat this? A lot of people recommend blocking the URL in Apache, for example, but that doesn’t always work as the hostname can be different.

I use a .htaccess file. An extract of the file follows. Remember that the string match is for a “is contained in” condition, so you don’t have to give the entire text of the referrer.

Because of a very stupid rule in this forum, you need to remove the spaces around the “n” in the string “mo n ey”. This dumb forum software won’t let me post the correct spelling of that word.

RewriteEngine on
# block visitors referred from
RewriteCond %{HTTP_REFERER} semalt\.com [NC,OR]
# block visitors referred from
RewriteCond %{HTTP_REFERER} savetubevideo\.com [NC,OR]
# block visitors referred from
RewriteCond %{HTTP_REFERER} kambasoft\.com [NC,OR]
# block visitors referred from makemo n
RewriteCond %{HTTP_REFERER} makemo n eyonline\.com [NC,OR]
# block visitors referred from best-seo-{whatever}
RewriteCond %{HTTP_REFERER} best-seo- [NC,OR]
# block visitors referred from buttons-for-{whatever}
RewriteCond %{HTTP_REFERER} buttons-for- [NC,OR]
RewriteRule .* - [F]

There are other rules dealing with various UA’s that I don’t allow on my site.

Thanks @canajun2eh, very helpful!

Hi there,

We wrote a blog post about stopping Referrer Spam: Stopping Referrer Spam - Analytics Platform - Matomo


currently I’m running Piwik 2.14.0 but I still have referer spam in my referer list on the dashboard. :frowning:

Is there any setting I need to tweak to activate spam blocking?

I am using Wordfence and added referrers sites in advanced blocking. But still some new ones are not blocked.

Hi there,

Feel free to try again installing with the latest 2.15.0 beta version which includes many fixes and improvements, see: I would like to test early beta and RC releases, how do I enable automatic updates to use these development versions? - Analytics Platform - Matomo

If you still have a problem, please create an issue on our tracker GitHub - matomo-org/piwik: Liberating Web Analytics. Star us on Github? +1. Matomo is the leading open alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites, apps & the IoT and visualise this data and extract insights. Privacy is built-in. We love Pull Requests!