How to Self-Host Ackee Analytics with Docker

Published: (March 19, 2026 at 04:03 AM EDT)
6 min read
Source: Dev.to

Source: Dev.to

What Is Ackee?

Ackee is a self‑hosted, privacy‑focused analytics tool that tracks page views, referrers, browsers, and operating systems without cookies.
It stores data in MongoDB, exposes a GraphQL API, and provides a clean single‑page dashboard.
Ackee is aimed at developers who want basic traffic metrics without the complexity of Matomo or the cloud dependency of Google Analytics.

Prerequisites

RequirementDetails
OSLinux server (Ubuntu 22.04 + recommended)
DockerDocker & Docker Compose installed – see the [Docker guide]
Memory512 MB free RAM
Disk2 GB free disk space
DomainA domain name (recommended for CORS & HTTPS)

Docker‑Compose Setup

Create a docker-compose.yml file:

services:
  ackee:
    image: electerious/ackee:3.5.1
    container_name: ackee
    restart: unless-stopped
    ports:
      - "3000:3000"
    environment:
      ACKEE_MONGODB: "mongodb://mongo:27017/ackee"
      ACKEE_USERNAME: "admin"                 # CHANGE: dashboard login username
      ACKEE_PASSWORD: "change-this-password"  # CHANGE: use a strong password
      ACKEE_ALLOW_ORIGIN: "https://example.com" # CHANGE: your website's domain (CORS)
    depends_on:
      - mongo
    networks:
      - analytics

  mongo:
    image: mongo:7.0.16
    container_name: ackee-mongo
    restart: unless-stopped
    volumes:
      - ackee-data:/data/db
    networks:
      - analytics

networks:
  analytics:
    driver: bridge

volumes:
  ackee-data:

Environment Variables

VariablePurpose
ACKEE_MONGODBMongoDB connection string
ACKEE_USERNAMEDashboard login username
ACKEE_PASSWORDDashboard login password
ACKEE_ALLOW_ORIGINCORS origin – set to your website’s domain (comma‑separate for multiple)
ACKEE_AUTO_ORIGINSet to true to allow all origins (less secure)

Starting the Stack

docker compose up -d
  • Open the dashboard at http://:3000
  • Log in with the username & password defined in the environment variables
  • Settings → Domains → Add Domain → enter your site’s name & domain

Tracking Script

Copy the generated snippet and place it inside the “ of your website:

  • The script is ~2 KB, loads asynchronously, and sets no cookies.
  • Ackee can track multiple sites from a single instance; each gets its own domain ID & snippet.

Enabling Detailed Mode (optional)

Detailed mode collects screen size, language, and referrer per visit. It remains cookieless but provides more granularity.

GraphQL API

{
  domains {
    id
    title
    statistics {
      views {
        id
        count
      }
    }
  }
}
  • Endpoint: https://your-ackee-instance.com/api
  • Authentication: Bearer token (create permanent tokens in Settings → Tokens)

Production Deployment Behind HTTPS (Reverse Proxy)

server {
    listen 443 ssl;
    server_name analytics.example.com;

    location / {
        proxy_pass http://localhost:3000;
        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;
    }
}

Tip: HTTPS is strongly recommended. ACKEE_ALLOW_ORIGIN works best with HTTPS origins, and browsers may block the tracker on mixed‑content pages. See the Reverse Proxy Setup guide for a full configuration.

Backing Up MongoDB Data

# Dump the database inside the container
docker exec ackee-mongo mongodump --out /tmp/backup --db ackee

# Copy the dump to the host
docker cp ackee-mongo:/tmp/backup ./ackee-backup-$(date +%Y%m%d)

Alternatively, back up the entire ackee-data Docker volume with tools like Restic or BorgBackup. See the Backup Strategy documentation.

Common Issues & Fixes

SymptomFix
Dashboard shows zero views after adding the scriptCheck the browser console for CORS errors. ACKEE_ALLOW_ORIGIN must exactly match your site’s origin (protocol, sub‑domain, port).
Login returns 401 or dashboard is blankVerify ACKEE_USERNAME and ACKEE_PASSWORD are correct. Restart the container after changes: docker compose restart ackee
Logs show MongoNetworkError: connect ECONNREFUSEDEnsure the MongoDB container is running and on the same Docker network: docker compose ps & docker network ls

Resource Usage (Typical)

ResourceApprox. Usage
RAM150‑300 MB (Ackee ~50 MB + MongoDB ~100‑200 MB)
CPUMinimal
Disk1‑5 GB (depends on traffic volume & retention)

When to Use (or Not Use) Ackee

Pros

  • Extremely lightweight – only the basics: page views, referrers, browsers, screen sizes.
  • GDPR‑friendly out of the box (anonymous mode).
  • GraphQL API for custom integrations.

Cons

  • No funnels, goals, custom events, or campaign tracking.
  • Outgrows quickly if you need advanced analytics.

Alternatives:

  • Plausible or Umami – add goals & custom events.
  • Matomo – full‑featured, but heavier.

GDPR & Cookie‑Free Operation

  • Anonymous mode (default): No personally identifiable information, no cookies, only aggregate metrics. No consent banner required.
  • Detailed mode: Collects a bit more (screen size, language, referrer) but still cookieless and avoids fingerprinting.

Tracking Multiple Websites

  1. In the Ackee dashboard, go to Settings → Domains → Add Domain.
  2. Each domain receives a unique Domain ID and tracking snippet.
  3. Insert the corresponding snippet on each site’s “.

Overview

There is no hard limit to the number of domains a single Ackee instance can track—the main constraint is MongoDB storage, which grows with traffic volume.

  • Ackee – the most minimal option: basic page views, referrers, browsers, and screen sizes with a GraphQL API.
  • Plausible – adds goals, custom events, and campaign tracking in a polished dashboard.
  • Umami – sits between the two, offering custom events with a simpler setup than Plausible.

Choose Ackee if you genuinely want bare‑minimum analytics with an API.

Tracker Blocking

Some privacy‑focused ad blockers maintain lists of known analytics domains, so Ackee’s tracker script can be blocked. Self‑hosting helps because your Ackee instance runs on your own domain, making it harder for blockers to identify. You can further reduce blocking by proxying the tracker script through your main website’s domain.

Resource Requirements

  • Ackee itself uses only ~50 MB of RAM.
  • The bottleneck is MongoDB, which needs at least 100–200 MB.

A Raspberry Pi 4 with 2 GB RAM handles Ackee comfortably for low‑to‑moderate traffic sites. Use the ARM64 MongoDB image:

docker pull mongo:7.0.16

which runs natively on Pi 4/5.

Data Retention

Ackee doesn’t have built‑in data‑retention policies. Data accumulates in MongoDB indefinitely. To manage storage you can:

  1. Manually delete old records via MongoDB queries.
  2. Set up a cron job that drops old entries.
  3. Use MongoDB’s TTL index feature to automate expiration (configure it on the relevant collections).

Topics & Guides

  • Best Self‑Hosted Analytics
  • How to Self‑Host Plausible
  • How to Self‑Host Umami
  • Plausible vs Umami
  • Replace Google Analytics
  • Docker Compose Basics
  • Reverse Proxy Setup
  • Backup Strategy
0 views
Back to Blog

Related posts

Read more »