Self-hosting GoatCounter the easy way

Self-hosting GoatCounter the easy way

Yulei Chen - Content-Engineerin bei sliplane.ioYulei Chen
5 min

GoatCounter is a lightweight, privacy-friendly web analytics platform. Unlike Google Analytics, it doesn't use cookies, doesn't track personal data, and is fully GDPR-compliant out of the box. GoatCounter offers a free hosted plan for non-commercial use, but the commercial plans start at $15/month and you share infrastructure with everyone else. Self-hosting gives you full control over your data and unlimited sites.

Sliplane is a managed container platform that makes self-hosting painless. With one-click deployment, you can get GoatCounter up and running in minutes - no server setup, no reverse proxy config, no infrastructure to maintain.

Prerequisites

Before deploying, ensure you have a Sliplane account (free trial available).

Quick start

Sliplane provides one-click deployment with presets.

SliplaneDeploy GoatCounter >
  1. Click the deploy button above
  2. Select a project
  3. Select a server (If you just signed up you get a 48-hour free trial server)
  4. Click Deploy!

About the preset

The one-click deploy above uses Sliplane's GoatCounter preset. Here's what's included:

  • Official arp242/goatcounter Docker image
  • Version 2.7.0 pinned for stability
  • Persistent storage mounted to /home/goatcounter/goatcounter-data for the SQLite database
  • Automatic database migrations enabled via the -automigrate flag
  • Healthcheck configured at /status

Next steps

Once GoatCounter is running on Sliplane, access it using the domain Sliplane provided (e.g. goatcounter-xxxx.sliplane.app).

Initial setup

On first launch, GoatCounter shows a setup wizard in your browser. You'll create your first site and admin account right there. Just navigate to your Sliplane domain and follow the on-screen instructions.

Adding tracking to your site

After creating your site, add the GoatCounter script tag to your website:

<script data-goatcounter="https://YOUR-SLIPLANE-DOMAIN/count"
        async src="//YOUR-SLIPLANE-DOMAIN/count.js"></script>

Replace YOUR-SLIPLANE-DOMAIN with your actual Sliplane domain (e.g. goatcounter-xxxx.sliplane.app).

Environment variables

GoatCounter uses a GOATCOUNTER_ prefix for environment variables. You can customize behavior by adding them in your Sliplane service settings:

VariableDefaultDescription
GOATCOUNTER_LISTEN*:8080Address and port to listen on
GOATCOUNTER_DBsqlite+./goatcounter-data/db.sqlite3Database connection string
GOATCOUNTER_SMTP(none)SMTP server for sending emails

Logging

GoatCounter logs to stdout by default, which integrates well with Sliplane's built-in log viewer. For general Docker log tips, check out our post on how to use Docker logs.

Cost comparison

You can also self-host GoatCounter with other cloud providers. Here is a pricing comparison for the most common ones:

ProvidervCPURAMDiskMonthly CostNote
Sliplane22 GB40 GB€9 (~$10.65)Flat rate, 1 TB bandwidth, SSL included
Fly.io22 GB40 GB~$18Disk and bandwidth billed separately
Render12 GB40 GB~$35100 GB bandwidth, Disk billed separately
Railway22 GB40 GB~$67 + $20 planPro plan floor, usage-based, bandwidth billed separately
Click here to see how these numbers were calculated.

(Assuming an always-on instance running 730 hrs/month)

  • Sliplane: flat €9/month for the Base server. Unlimited services on the same server, 1 TB egress and SSL included.
  • Fly.io: shared-cpu-2x 2 GB = $11.83/mo + 40 GB volume × $0.15/GB = $6 -> ~$17.83/mo. Egress billed separately ($0.02/GB in EU).
  • Render: closest match is Standard ($25, 1 vCPU / 2 GB) plus 40 GB disk × $0.25/GB = $10 -> ~$35/mo. Stepping up to Pro (2 vCPU / 4 GB) costs $85/mo + disk.
  • Railway (Pro plan): CPU 2 × $0.00000772/s × 2,628,000 s = $40.57; RAM 2 × $0.00000386/s × 2,628,000 s = $20.29; volume 40 × $0.00000006/s × 2,628,000 s = $6.31 -> ~$67/mo compute, plus the $20/mo Pro plan floor and $0.05/GB egress.

Bandwidth costs can add up fast on usage-based providers. Use our bandwidth cost comparison tool to see what your egress would cost on each platform.

FAQ

What can I track with GoatCounter?

GoatCounter tracks pageviews, referrers, browser and OS stats, screen sizes, countries, and languages. It does all of this without cookies and without collecting any personal data. You can also set up custom events to track button clicks or other user actions.

How do I configure GoatCounter for multiple sites?

GoatCounter's serve command runs a single-site instance by default. If you need multiple sites, you can run the saas command instead, which enables multi-tenant mode. Set the GOATCOUNTER_LISTEN environment variable and adjust the command in your Sliplane service settings.

How do I update GoatCounter?

Change the image tag in your service settings on Sliplane (e.g. from 2.7.0 to a newer version) and redeploy. Check Docker Hub for the latest stable version. The -automigrate flag ensures database schema updates run automatically.

Are there alternatives to GoatCounter?

Popular alternatives include Plausible Analytics (another privacy-first option), Umami (open-source with a modern UI), and Matomo (feature-rich Google Analytics replacement). For dashboarding and metrics visualization, check out self-hosting Grafana the easy way or 5 awesome Grafana alternatives.

Does GoatCounter work behind a CDN or reverse proxy?

Yes. GoatCounter reads the X-Forwarded-For and X-Real-IP headers to determine visitor IPs. Since Sliplane handles TLS termination and reverse proxying for you, GoatCounter works out of the box without any extra configuration.

Self-host GoatCounter now - It's easy!

Sliplane gives you all the tools you need to run GoatCounter without server hassle.