|Martin Tournoij a4511bdaa7 Don't try to load a settings tab if the hash is empty||23 hours ago|
|.github||4 days ago|
|acme||2 weeks ago|
|bin||1 month ago|
|cfg||1 week ago|
|cmd||23 hours ago|
|cron||3 days ago|
|db||3 days ago|
|docs||2 weeks ago|
|handlers||1 day ago|
|pack||23 hours ago|
|public||23 hours ago|
|tpl||1 day ago|
|.codecov.yaml||4 months ago|
|.gitattributes||1 month ago|
|.gitignore||4 days ago|
|.gogo-release||2 days ago|
|.ignore||2 months ago|
|.travis.yml||2 months ago|
|LICENSE||2 weeks ago|
|README.markdown||2 days ago|
|admin.go||1 week ago|
|blacklist.go||1 month ago|
|gen.go||1 week ago|
|go.mod||23 hours ago|
|go.sum||23 hours ago|
|hit.go||1 day ago|
|hit_test.go||2 weeks ago|
|init.go||1 week ago|
|memstore.go||1 week ago|
|memstore_test.go||2 weeks ago|
|netlify.toml||1 day ago|
|site.go||1 day ago|
|site_test.go||1 day ago|
|test.go||2 weeks ago|
|update.go||2 weeks ago|
|user.go||1 day ago|
GoatCounter is a web analytics platform, roughly similar to Google Analytics or Matomo. It aims to give meaningful privacy-friendly web analytics for business purposes, while still staying usable for non-technical users to use on personal websites. The choices that currently exist are between freely hosted but with problematic privacy (e.g. Google Analytics), hosting your own complex software or paying $19/month (e.g. Matomo), or extremely simplistic “vanity statistics”.
There are two ways to run this: as hosted service on goatcounter.com, free for non-commercial use, or run it on your own server.
See docs/rationale.markdown for some more details on the “why?” of this project.
There’s a live demo at https://stats.arp242.net.
Please consider donating if you’re self-hosting GoatCounter so I can pay my rent :-)
Lightweight and fast; adds just 3.5K (1.9K compressed) of extra data to your site.
Easy; if you’ve been confused by the myriad of options and flexibility of Google Analytics and Matomo that you don’t need then GoatCounter will be a breath of fresh air.
100% committed to open source; you can see exactly what the code does and make improvements.
Own your data; you can always export all data and cancel at any time.
Fast: can handle about 800 hits/second on a $5/month Linode VPS using the default settings.
Self-contained binary: everything – including static assets – is in a single ~7M statically compiled binary. The only other thing you need is a SQLite database file or PostgreSQL connection (no way around that).
There are binaries on the releases page, or compile from source with
go get zgo.at/goatcounter/cmd/goatcounter, which will put the binary at
Go 1.12 and newer are supported (it follows the Go release policy). You will need a C compiler (for SQLite) or PostgreSQL.
For a production environment run something like:
-prod \ -smtp 'smtp://localhost:25' \ -plan 'pro' \ -domain 'example.com' \ -domainstatic 'static.example.com' \ -emailerrors 'firstname.lastname@example.org' \ "$@"
The default is to use a SQLite database at
be created if it doesn’t exist). See the
-dbconnect flag to customize this.
-prod flag affects various minor things; without it it’ll try to load
templates from the filesystem (instead of using the built-in ones), for
-smtp is required to send login emails. You can use something like Mailtrap
if you just want it for yourself, but you can also use your Gmail or whatnot.
You can see the goathost repo for the server configuration of goatcounter.com, although that is just one way of running it.
You may need to run run database migrations when updating. Use
-migrate auto to always run all pending migrations on startup. This is the
easiest way, although arguably not the “best” way.
goatcounter -migrate <file> or
goatcounter -migrate all to manually run
migrations; generally you want to upload the new version, run migrations while
the old one is still running, and then restart so the new version takes effect.
Both SQLite and PostgreSQL are supported. SQLite should work well for the vast majority of people and is the recommended database engine. PostgreSQL will not be faster in most cases, and the chief reason for adding support in the first place is to support load balancing web requests over multiple servers. To use it:
Create the database, unlike SQLite it’s not done automatically:
$ createdb goatcounter $ psql goatcounter -c ‘\i db/schema.pgsql’
-dbconnect, for example:
$ goatcounter -pgsql -dbconnect ‘user=goatcounter dbname=goatcounter sslmode=disable’
See the pq docs for more details on the connection string.
You can compile goatcounter without cgo if you don’t use SQLite:
$ CGO_ENABLED=0 go build
Functionally it doesn’t matter too much, but you won’t need a C compiler, builds will be faster, and makes creating static binaries easier.
See .github/CONTRIBUTING.markdown for details on how to run a development server, write patches, etc.