DEV Community

Cover image for Why I Chose GoatCounter for my GitHub Pages Site
Bharathkumar
Bharathkumar

Posted on

Why I Chose GoatCounter for my GitHub Pages Site

Simple Analytics for GitHub Pages: Why I Chose GoatCounter

Adding analytics to a static site usually ends in one of two ways:

  1. Google Analytics: A privacy nightmare that requires a GDPR cookie banner.
  2. No Analytics: You fly blind and never know if anyone visited.

I needed a middle ground for my GitHub Pages site. I looked at the big three options.

1. Google Analytics (Why Not?)

GA4 is overkill. It tracks everything, sells the data, and forces you to annoy users with cookie consent popups. I just want to know how many people clicked my "Install" button.

2. Cloudflare Web Analytics (Why Not?)

Cloudflare offers great free analytics.
The Problem: It expects you to own the domain.
Because I use a github.io subdomain, I cannot easily proxy my DNS through Cloudflare. Without DNS control, the setup becomes friction. I wanted "drop-in" simplicity.

3. Umami (Why Not?)

Umami is fantastic and open-source.
The Problem: Hosting.
You must self-host it (on Vercel/Railway) and manage a database (Supabase/Postgres). That is too much maintenance for a simple documentation site.

The Winner: GoatCounter 🐐

GoatCounter hit the sweet spot.

  • Hosted: No server to manage.
  • Free: Generous tier for non-commercial projects.
  • Privacy: No cookies. No GDPR banners required.
  • Universal: Works on any domain, including github.io.

How We Integrated It

The setup took 2 minutes.

Step 1: Get the Code

Sign up at GoatCounter and get your link context.

Step 2: Add the Script

We added a single JS file to our docs/ folder to keep it clean.

docs/index.html:

<script data-goatcounter="https://your-code.goatcounter.com/count"
        async src="count.js"></script>
Enter fullscreen mode Exit fullscreen mode

We host the count.js locally to avoid external dependencies blocking the main thread, though you can load it from their CDN too.
But still it blocked by Brave's adblocker.

Check out the Git-Scope Docs to see it in action.

Top comments (0)