고객 지원 문의

이메일로 답장드리며, 보통 이틀 안에 회신합니다.

Google reCAPTCHA가 이 제출을 악용 여부에 대해 확인하며, 이 과정에서 데이터가 Google로 전송됩니다. 스크립트는 이 양식을 열 때만 불러옵니다.

← 전체 글

A counter for static sites

Static hosting has quietly become the sensible way to put a small site on the internet. GitHub Pages, Codeberg Pages, Neocities, or a folder of files on any cheap host: no database, no server-side language, nothing to update, nothing to get compromised.

It has exactly one gap. There is no server log to read, and no way to run anything that would do the counting. A site goes up, and nothing says whether anybody came.

This is the situation a visitor counter was invented for, and it is why they are not actually obsolete.

What it takes

The snippet from the statistics page goes into the HTML, at the spot where the counter belongs. That is the whole procedure. It works because the counter is an image and a small script — two things that any static host serves without knowing or caring what they are.

a static hosta folder of files<img> · <script>our servercounting, storage, chartsnothing to install, no database to keep, no cron job to forget

The counting happens on our server. The host stays a folder of files.

Do not copy the script into the repository

This is the one piece of advice worth the whole post, because static-site habits push hard the other way. Vendoring dependencies into the repo is normally good practice — it is reproducible, it survives an upstream disappearing, and it saves a request.

Do not do it here.

A copied script is frozen at the moment of copying. It keeps doing whatever it did that day, forever, on every visit, and nothing anybody does upstream can reach it. That is not a hypothetical: when the screen resolution was removed from the counter this year, copies of the old script kept sending it, and the only way to end the collection was to make the server refuse the value from anybody at all.

The same applies to security fixes, to changes in what gets sent, and to anything else that ought to reach the visitors of a site. Link the script. It is one request, it caches, and it stays current.

What it delivers, and what it does not

The counter delivers visitor counts, days, countries, browsers, referring domains, the most-visited pages, and a live view of who is on the site right now. For a personal site, a project page, or a small shop front, that is usually the entire set of questions.

What it cannot deliver is log analysis, because there is no log. Nothing about requests that fail, files that 404, or bandwidth. Where those matter, static hosting was already the wrong shape for the problem.

One more thing that suits static sites

Nothing here needs an account. There is no signup, no password to store in a repository, and no key to leak into a public commit — a category of accident that static-site projects are unusually good at having.

광고