OpenSourcePicks

Open source alternatives to popular software, with live GitHub data

GitHub stats refreshed every day

GoatCounter

Deliberately simple web statistics in a single Go binary, running on SQLite or PostgreSQL

Open source alternative to

Visit GoatCounterGitHubDocumentation

Main features

  • Visit counts that ignore reloads and repeat views
  • Referrers and campaigns
  • Browsers, screen sizes and locations
  • Click and custom events through data attributes or JavaScript
  • Tracking pixel that works without JavaScript
  • Import of nginx, Apache, Caddy and CloudFront log files
  • HTTP API for counting pageviews from your backend
  • Embeddable public visitor counter
  • Full export as CSV or JSON
  • Built-in TLS with automatic certificates

What GoatCounter does

GoatCounter counts visits and keeps the rest out. It reports pages, referrers, campaigns, browsers, screen sizes and locations, and supports click and custom events, but it does not try to be a product analytics suite: its documentation does not cover funnels, retention, user profiles or session replay.

What it lacks in reports it makes up for in ways to collect data. Besides the JavaScript snippet, you can count with a tracking pixel that needs no JavaScript, send pageviews from your own backend through the HTTP API, or import existing server logs from nginx, Apache, Caddy, CloudFront and others. That makes it one of the few tools here that can produce statistics for a site without adding any script to the pages.

Privacy and cookies

GoatCounter does not use cookies. To recognize a unique visit, it keeps a key made from the site, user agent and IP address in memory only, mapped to a random ID for eight hours; the IP address and user agent are never written to disk or to the database. The author’s view is that a GDPR consent notice is probably not needed, while noting that this is not legal advice, and the documentation includes an example banner for sites that want one. The script is about 3.5 KB according to the README.

Self-hosting GoatCounter

Self-hosting is the simplest in this category. GoatCounter is distributed as a statically compiled binary that needs only a SQLite file or a PostgreSQL database, and it can also run with Docker, Docker Compose or Podman. It even handles TLS certificates itself. SQLite is recommended for smaller sites and PostgreSQL for larger ones; the README notes that performance depends more on the number of distinct pages than on the number of pageviews. No minimum hardware is documented.

Hosted version

The author runs goatcounter.com, which is free for reasonable public use and funded by donations through GitHub Sponsors. Very busy sites are asked to host their own copy.

Limitations

The scope is deliberately narrow, so teams that need funnels or user-level analysis will outgrow it. The project is effectively maintained by one person, who has made almost all of the commits. The license is a modified EUPL 1.2 rather than a standard SPDX license, which some legal teams will want to review.

Who it suits

GoatCounter suits personal sites, blogs, open source project pages and small businesses that want honest traffic numbers with as little setup as possible, including people who would rather count from server logs than add a script.

License details

EUPL-1.2. A slightly modified EUPL 1.2: some licenses are removed from the compatible-licenses appendix, which is why GitHub does not detect it. The count.js script is under ISC.

Technical details

Self-hosting needs

  • SQLite or PostgreSQL

Built with

  • Go

GitHub topics

  • analytics
  • go
  • golang

Reviewed by the OpenSourcePicks editors from the project's repository and documentation. Something out of date? Tell us.