Setting Up Vince Analytics: A Self-Hosted Alternative to Google Analytics

Setting up Plausible Analytics feels like preparing for a wedding - you need multiple components (PostgreSQL, ClickHouse), plenty of resources, and constant maintenance. But what if I told you there's a simpler alternative? Enter Vince Analytics, the minimalist approach to self-hosted analytics.

Today, I want to share my experience setting up Vince Analytics, a privacy-focused, self-hosted alternative to Google Analytics. If you're looking for a GDPR-compliant analytics solution that's both cost-effective and resource-efficient, this guide is for you.

Why Vince Over Plausible?

The key differences that make Vince a superior choice:

  • Single Binary: Unlike Plausible's multiple dependencies, Vince runs as a single binary
  • Resource Efficient: No need for separate databases or heavy infrastructure
  • Simpler Maintenance: Less moving parts means fewer potential points of failure
  • Cost Effective: Lower server requirements translate to reduced hosting costs

What is Vince Analytics?

Vince Analytics is a lightweight, privacy-focused analytics platform that ships as a single binary without external dependencies. It offers:

  • Privacy-friendly tracking (GDPR, CCPA, and PECR compliant)
  • No cookie notices required
  • Automatic TLS support
  • Custom event tracking
  • Goal conversions
  • File download tracking
  • Outbound link tracking
  • 404 page tracking
  • Support for unlimited websites and events

Technical Setup

Here's how I set up Vince Analytics with Docker and SSL:

version: '3.8'

services:
  vince:
    image: ghcr.io/vinceanalytics/vince
    ports:
      - "8080:8080"
    volumes:
      - ./vince-data:/vince-data
    command: serve --adminName your_admin --adminPassword your_password --domains your.domain.com
    networks:
      - app-network

  nginx:
    image: nginx:alpine
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx/conf.d:/etc/nginx/conf.d
      - ./certbot/conf:/etc/letsencrypt
      - ./certbot/www:/var/www/certbot
    networks:
      - app-network
    depends_on:
      - vince

  certbot:
    image: certbot/certbot
    volumes:
      - ./certbot/conf:/etc/letsencrypt
      - ./certbot/www:/var/www/certbot

networks:
  app-network:
    driver: bridge

Then create folder nginx/conf.d and file config nginx/conf.d/app.conf.

Generate SSL

After preparing the docker compose file, the next step would be generate ssl.

  1. First, let's modify the nginx config to handle HTTP first. Update your nginx/conf.d/app.conf:
server {
    listen 80;
    server_name vince.ngooding.com;
    
    location /.well-known/acme-challenge/ {
        root /var/www/certbot;
    }

    location / {
        proxy_pass http://vince:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
  1. Start nginx first:
docker compose up -d nginx
  1. Now run certbot:

Make sure that you change vince.ngooding.com with your own domain and example@gmail.com with your email.

docker compose run --rm certbot certonly --webroot --webroot-path /var/www/certbot \
    --email example@gmail.com --agree-tos --no-eff-email \
    -d vince.ngooding.com
  1. After successful certificate generation, update nginx/conf.d/app.conf back to include SSL:
server {
    listen 80;
    server_name vince.ngooding.com;
    
    location /.well-known/acme-challenge/ {
        root /var/www/certbot;
    }

    location / {
        return 301 https://$host$request_uri;
    }
}

server {
    listen 443 ssl;
    server_name vince.ngooding.com;

    ssl_certificate /etc/letsencrypt/live/vince.ngooding.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/vince.ngooding.com/privkey.pem;

    location / {
        proxy_pass http://vince:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
  1. Finally restart everything:
docker compose down
docker compose up -d
  1. Add ssl renewal script
touc ssl-renew.sh

The script

#!/bin/bash
docker compose run --rm certbot renew
docker compose exec nginx nginx -s reload

Make it executable:

chmod +x ssl-renew.sh

Set up automatic renewal with cron:

# Open crontab
crontab -e

# Add this line to run twice daily
0 */12 * * * /path/to/your/ssl-renew.sh

Conclusion

Vince Analytics offers a compelling alternative to traditional analytics platforms. Its focus on privacy, efficiency, and ease of deployment makes it an excellent choice for businesses and developers who want to maintain control over their analytics data while ensuring compliance with privacy regulations.

The self-hosted nature of Vince means you have complete control over your data, and its efficient design ensures you can gather valuable insights without compromising on performance or user privacy.


Ready to try Vince Analytics? Check out the official documentation or the GitHub repository to get started.