Lightweight Analytics for Jekyll: Why I Chose Hit Kounter Over Google Analytics
Source: Dev.to
Privacy and Speed First
- No Google Analytics – I don’t want my site blocked or slowed down by heavy tracking scripts (especially considering accessibility in different regions).
- Minimalist Integration – It should be as “plug‑and‑play” as Jekyll itself.
After searching, I found Hit Kounter. It’s simple, fits perfectly with static sites, and just works.
How to Set It Up in 2 Minutes
1. The Header Injection
Add the following snippet to your _includes/head.html (or equivalent) file:
2. Displaying Views on Post Pages
Insert this where you want the view count to appear on each post:
The data-url attribute automatically detects the current URL.
3. Displaying View Counts on the Homepage
Use a similar snippet in your homepage template:
{% for post in site.posts %}
<article>
<h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
<p>Views: <span class="hit-kounter" data-url="{{ site.url }}{{ post.url }}"></span></p>
</article>
{% endfor %}
Pro Tip: Hit Kounter requires the absolute URL (including protocol) to track accurately. Ensure you prepend site.url and explicitly add https:. Without the full protocol, the counter won’t trigger.
That’s All!
Another small step toward building the perfect minimalist writing environment.
What are you using to track your static site? Are you a fan of self‑hosted analytics or do you prefer these “Zero‑Config” tools? Let me know in the comments!