Skip to content
Simple web statistics. No tracking of personal data.
Go JavaScript CSS PLpgSQL TSQL Shell Python
Branch: master
Clone or download
Latest commit 8cb692f Aug 23, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Add FUNDING.yml Aug 14, 2019
bulk Few minor testing changes from domains branch Aug 21, 2019
cfg Ability to add subsites Aug 23, 2019
cmd/goatcounter Just warn, don't panic Aug 19, 2019
cron Less verbose logging Aug 19, 2019
db Fix migration name Aug 23, 2019
handlers Update pack.go Aug 23, 2019
public Ability to add subsites Aug 23, 2019
smail PostgreSQL support Aug 5, 2019
tpl Better feedback when logging in with wrong email Aug 23, 2019
.codecov.yaml Configure codecov Aug 23, 2019
.gitattributes Update Jul 11, 2019
.gitignore
.ignore Fix TODOs, SQL performance improvements Jul 31, 2019
.travis.yml Add Travis Aug 6, 2019
LICENSE Add APLGv3 license Aug 1, 2019
README.markdown Ability to add subsites Aug 23, 2019
blacklist.go Clean refs Jul 8, 2019
browsers.go
gen.go Add APLGv3 license Aug 1, 2019
go.mod Better feedback when logging in with wrong email Aug 23, 2019
go.sum Ability to add subsites Aug 23, 2019
hit.go Don't treat android-app://.. URLs as HTTP Aug 19, 2019
hit_test.go Don't treat android-app://.. URLs as HTTP Aug 19, 2019
init.go Few minor testing changes from domains branch Aug 21, 2019
init_test.go Few minor testing changes from domains branch Aug 21, 2019
memstore.go Even less verbose logging Aug 19, 2019
site.go Ability to add subsites Aug 23, 2019
site_test.go Ability to add subsites Aug 23, 2019
test.go Ability to add subsites Aug 23, 2019
user.go Ability to add subsites Aug 23, 2019

README.markdown

GoatCounter is a web counter.

There are two ways to run this: as hosted service starting at $3/month (free during initial beta!) or run it on your own server. Check out https://www.goatcounter.com for the hosted service and user documentation.

There's a live demo at https://arp242.goatcounter.com.

The current status is public beta, or "MVP" (Minimum Viable Product) to get feedback from others. That being sad, it should be stable and useful. It just doesn't have all the features I'd like it to have (yet).

Please consider donating if you're self-hosting GoatCounter so I can pay my rent :-) Also see the announcement post.


Basically I quit my day job to try and make a living from creating open source software full-time (or free software, if you prefer). So supporting isn't just a nice way to say "thanks mate", it's directly supporting future development.

Features

  • Privacy-aware; doesn't track users; doesn't need a GDPR notice.

  • Lightweight and fast; adds just 0.8KB 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.

  • Accessibility is a high-priority feature, and the interface works well with screen readers, no JavaScript, and even text browsers.

  • 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.

Technical

  • Fast: can handle about 800 hits/second on a $5/month Linode VPS – which is also running hitch and varnish – using the default settings.

  • Self-contained binary: everything (including static assets) is in a single 5M statically compiled binary.

Running your own

You will need Go 1.10 or newer and a C compiler (for SQLite) or PostgreSQL.

Development

  1. Install it with:

    $ git clone git@github.com:zgoat/goatcounter.git
    $ cd goatcounter
    $ go build ./cmd/goatcounter
    

    This will put a self-contained binary at goatcounter. You can optionally reduce the binary size a bit (from ~18M to ~5M) with strip and/or upx.

  2. Run ~/go/goatcounter. This will run a development environment on http://goatcounter.localhost:8081

    The default is to use a SQLite database at ./db/goatcounter.sqlite3 (will be created if it doesn't exist). See the -dbconnect flag to customize this.

  3. You can sign up your new site at http://goatcounter.localhost:8081, which can then be accessed at http://test.goatcounter.localhost:8081

Production

  1. For a production environment run something like:

    goatcounter \
        -prod \
        -sentry "https://...:...@sentry.io/..." \
        -domain "goatcounter.com" \
        -domainstatic "static.goatcounter.com" \
        -smtp "smtp://localhost:25" \
        "$@"
    
  2. Use a proxy for https (e.g. Caddy); you'll need to forward example.com and *.example.com

You can see the goathost repo for the server configuration of goatcounter.com, although that is just one way of running it.

PostgreSQL

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:

  1. Create the database, unlike SQLite it's not done automatically:

    $ createdb goatcounter
    $ psql goatcounter -c '\i db/schema.pgsql'
    
  2. Optionally convert the SQLite database:

    $ ./db/export-sqlite.sh ./db/goatcounter.sqlite3 | psql goatcounter
    
  3. Run with -pgsql and -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’t perform that action at this time.