This website is hosted on Sourcehut Pages, a minimalistic static web hosting offered by Sourcehut. Among the limitations (listed here), there is a also a draconic Content Security Policy that blocks all resources not hosted on the server where this website is. All content from CDN or embedded third-party content is blocked.
This has the interesting consequence that one cannot host a visitor count software like Plausible, Matomo (and similar tools). In addition to that, since there is no administration backoffice of any sort, so in the end I have no visibility over basic stats like how many visitors and which articles are most visited.
So, in order to get some visibility about my visitors, I have added to the footer of any article a simple link pointing to my own server, where an nginx service is listening. The receiving host on that server does absolutely nothing but I will have evidence in the nginx logs that someone clicked the link of an article in this website.
An entry in the logs will look like this:
123.456.789.0123 - - [05/Nov/2023:16:31:11 +0000]
"GET /?article=poorman-visitor-counter
HTTP/2.0" 200 232 "http://www.city17.xyz/"
"Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0" "1.44"
This means that I get:
- IP address of the visitor
- Date of when the link was clicked
- User Agent
I don't care about anything else but the article visited so I will just go through the logs every once in a while and aggregate the number of articles visited.
For transparency, logs are deleted every month.
§ Future work
This is a pretty naive way to count visitors (it's voluntary based) but it's just an experiment and has the advantage of not requiring any JavaScript (which I want to avoid as long as possible).
Also, I want to avoid an excessive signal/noise ratio caused by spiders, bots and other junk, so I will implement some filtering that discards everything that does not look like human.
I'll let it run for a while and see what happens. To be honest, I'm not that motivated to get statistics about who visits my website :-)