matomo / referrer-spam-blacklist
Community-contributed list of referrer spammers
Installs: 212 627
Dependents: 2
Suggesters: 0
Security: 0
Stars: 668
Watchers: 68
Forks: 302
Open Issues: 2
Replaces
- dev-master
- 4.0.0
- 3.11.0
- 3.10.0
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-spmedia-patch-34
- dev-prtemplate
- dev-spmedia-patch-33
- dev-spmedia-patch-32
- dev-spmedia-patch-31
- dev-spmedia-patch-30
- dev-spmedia-patch-29
- dev-readme_pr
- dev-spmedia-patch-28
- dev-spmedia-patch-27
- dev-spmedia-patch-26
- dev-spmedia-patch-25
- dev-spmedia-patch-24
- dev-spmedia-patch-23
- dev-spmedia-patch-22
- dev-spmedia-patch-21
- dev-spmedia-patch-20
- dev-spmedia-patch-19
- dev-revert-1051-patch-42
- dev-spmedia-patch-18
- dev-spmedia-patch-17
- dev-spmedia-patch-16
- dev-spmedia-patch-15
- dev-spmedia-patch-14
- dev-spmedia-patch-13
- dev-spmedia-patch-12
- dev-spmedia-patch-11
- dev-spmedia-patch-10
- dev-spmedia-patch-9
- dev-spmedia-patch-8
- dev-ekwiaciarz
- dev-spmedia-patch-7
- dev-spmedia-patch-6
- dev-spmedia-patch-5
- dev-spmedia-patch-4
- dev-spmedia-patch-3
- dev-spmedia-patch-2
- dev-spmedia-patch-1
This package is auto-updated.
Last update: 2024-10-26 19:00:21 UTC
README
This is a community-contributed list of referrer spammers maintained by Matomo, the leading open source web analytics platform.
Usage
The list is stored in this repository in spammers.txt
. This text file contains one host per line.
You can download this file manually, download the whole folder as zip or clone the repository using git:
git clone https://github.com/matomo-org/referrer-spam-list.git
PHP
If you are using PHP, you can also install the list through Composer:
composer require matomo/referrer-spam-blacklist
Parsing the file should be pretty easy using your favorite language. Beware that the file can contain empty lines.
Here is an example using PHP:
$list = file('spammers.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
Nginx
Nginx's server
block can be configured to check the referer and return an error:
if ($http_referer ~ '0n-line.tv') {return 403;} if ($http_referer ~ '100dollars-seo.com') {return 403;} ...
When combined, list exceeds the max length for a single regex expression, so hosts must be broken up as shown above.
Here is a bash script to create an nginx conf file:
sort spammers.txt | uniq | sed 's/\./\\\\./g' | while read host; do echo "if (\$http_referer ~ '$host') {return 403;}" >> /etc/nginx/referer_spam.conf done;
you would then include /etc/nginx/referer_spam.conf;
inside your server
block
Now as a daily cron job so the list stays up to date:
0 0 * * * cd /etc/nginx/referrer-spam-blacklist/ && git pull > /dev/null && echo "" > /etc/nginx/referer_spam.conf && sort spammers.txt | uniq | sed 's/\./\\\\\\\\./g' | while read host; do echo "if (\$http_referer ~ '$host') {return 403;}" >> /etc/nginx/referer_spam.conf; done; service nginx reload > /dev/null
In Matomo (formerly Piwik)
This list is included in each Matomo release so that referrer spam is filtered automatically. Matomo will also automatically update this list to its latest version every week.
Contributing
To add a new referrer spammer to the list, click here to edit the spammers.txt file and select Create a new branch for this commit and start a pull request.
. In your pull request please explain where the referrer domain appeared and why you think it is a spammer. Please open one pull request per new domain.
If you open a pull request, it is appreciated if you keep one hostname per line, keep the list ordered alphabetically, and use Linux line endings.
Please search if somebody already reported the host before opening a new one.
Subdomains
Matomo does sub-string matching on domain names from this list, so adding semalt.com
is enough to block all subdomain referrers too, such as semalt.semalt.com
.
However, there are cases where you'd only want to add a subdomain but not the root domain. For example, add referrerspammer.tumblr.com
but not tumblr.com
, otherwise all *.tumblr.com
sites would be affected.
Sorting
To keep the list sorted the same way across forks it is recommended to let the computer do the sorting. The list follows the merge sort algorithm as implemented in sort. You can use sort to both sort the list and filter out doubles:
sort -uf -o spammers.txt spammers.txt
Community Projects
Apache .htaccess referrer spam blacklist - A script for Apache users that generates a list of RewriteConds based on spammers.txt
.
Disclaimer
This list of Referrer spammers is contributed by the community and is provided as is. Use at your own discretion: it may be incomplete (although we aim to keep it up to date) and it may contain outdated entries (let us know if a hostname was added but is not actually a spammer).
License
Public Domain (no copyright).