Limit hchart with on small screens
Still not perfect as it won't display "visit" in those cases, but at least it won't be wider than the screen.
|12 hours ago|
|.github||3 months ago|
|acme||1 month ago|
|bgrun||1 month ago|
|cfg||1 month ago|
|cmd||19 hours ago|
|cron||1 day ago|
|db||1 day ago|
|docs||4 days ago|
|gctest||1 day ago|
|handlers||1 day ago|
|pack||12 hours ago|
|public||12 hours ago|
|tpl||1 day ago|
|.editorconfig||2 months ago|
|.gitattributes||4 days ago|
|.gitignore||2 months ago|
|.gogo-release||2 months ago|
|.ignore||8 months ago|
|.travis.yml||4 weeks ago|
|CHANGELOG.markdown||1 day ago|
|LICENSE||2 days ago|
|README.markdown||1 week ago|
|admin.go||1 day ago|
|api_token.go||4 days ago|
|export.go||4 days ago|
|export_test.go||4 days ago|
|gen.go||4 days ago|
|go.mod||19 hours ago|
|go.sum||19 hours ago|
|helper.go||1 month ago|
|hit.go||1 day ago|
|hit_list.go||1 day ago|
|hit_stats.go||1 day ago|
|hit_test.go||1 day ago|
|kommentaar.conf||4 days ago|
|memstore.go||1 week ago|
|memstore_test.go||3 months ago|
|netlify.toml||5 months ago|
|ref.go||1 day ago|
|refspam.go||1 week ago|
|session.go||1 week ago|
|session_test.go||1 month ago|
|site.go||1 day ago|
|site_test.go||1 month ago|
|tplfunc.go||1 day ago|
|update.go||1 month ago|
|user.go||1 day ago|
GoatCounter is an open source web analytics platform available as a hosted service (free for non-commercial use) or self-hosted app. It aims to offer easy to use and meaningful privacy-friendly web analytics as an alternative to Google Analytics or Matomo.
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 (the source code is completely Open Source/Free Software, and it can be self-hosted without restrictions).
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 contributing financially if you’re self-hosting GoatCounter so I can pay my rent :-)
GoatCounter is sponsored by a grant from NLnet’s NGI Zero PET fund.
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.
Identify unique visits without cookies using a non-identifiable hash (technical details).
Keeps useful statistics such as browser information, location, and screen size. Keep track of referring sites and campaigns.
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.
Integrate on your site with just a single script tag:
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).
The release page has binaries for Linux amd64, arm, and arm64. These are statically compiled and should work in pretty much any Linux environment. GoatCounter should run on any platform supported by Go, but there are no binaries for them (yet); you’ll have to build from source for now (it’s not hard, I promise).
Compile from source with:
$ git clone -b release-1.3 https://github.com/zgoat/goatcounter.git $ cd goatcounter $ go build ./cmd/goatcounter
Or to build a statically linked binary:
$ go build \ -tags osusergo,netgo,sqlite_omit_load_extension \ -ldflags='-extldflags=-static' \ ./cmd/goatcounter
You’ll now have a
goatcounter binary in the current directory.
Go 1.13 and newer are supported (it follows the Go release policy). You
will need a C compiler (for SQLite), or compile it with
CGO_ENABLED=0 go build
and use PostgreSQL.
It’s recommended to use the latest release as in the above command. The master branch should be reasonably stable, but no guarantees, and sometimes I don’t write release/upgrade notes until the actual release.
It’s not recommended to use
go get in GOPATH mode since that will ignore the
dependency versions in go.mod.
You can start a test/development server with:
$ goatcounter serve -dev
The default is to use a SQLite database at
./db/goatcounter.sqlite3 (will be
created if it doesn’t exist). See the
-db flag to customize this.
You can create new sites with the
$ goatcounter create -email firstname.lastname@example.org -domain stats.example.com
This will ask for a password for your new account; you can also add a password
on the commandline with
-password. If you use a custom DB, you must also pass
-db flag here.
-dev flag makes some small things a bit more convenient for development.
For a production environment run something like:
$ goatcounter serve
By default it will use ACME to create https certificates; use
-tls none if you
want to disable it (e.g. if you’re running goatcounter behind a proxy which
already handles https for you).
You may need to run run database migrations when updating. Use
-automigrate 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.
goatcounter migrate show to get a list of pending migrations.
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 (you may need
to modify the
$ createdb goatcounter $ psql goatcounter -c ‘\i db/schema.pgsql’ $ goatcounter -db ‘postgresql://dbname=goatcounter’ migrate all
Run with custom
$ goatcounter serve
-db 'postgresql://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 builds will be a bit easier and faster as it won’t require a C compiler.
See .github/CONTRIBUTING.markdown for details on how to run a development server, write patches, etc.
Various aggregate data files are available at https://www.goatcounter.com/data