Self-hosting guide
How to self-host web and product analytics
Self-hosting analytics means operating the collection endpoint, application, databases, and dashboard on infrastructure you control. The software choice matters, but reliable DNS, TLS, secrets, backups, upgrades, and verification matter just as much.
Published Technical guide by Vectr4
Category
Self-hosted analytics
Product focus
Events, funnels, sessions, journeys
Deployment
Your VPS with Docker Compose
01
1. Choose web analytics or product analytics
Web analytics answers acquisition questions: visits, pages, referrers, campaigns, devices, and traffic trends. Product analytics answers behavior questions: events, activation, funnels, sessions, retention signals, and user journeys.
If you only need traffic reporting, compare the tools in our self-hosted Google Analytics alternatives guide. If you need to understand behavior inside a SaaS app, start with self-hosted product analytics.
02
2. Prepare the VPS and DNS
Choose a region and server size based on expected event volume, retention, query load, and backup needs. Create a dedicated hostname, restrict administrative access, patch the operating system, and install Docker from its maintained distribution channel.
- Use SSH keys and limit privileged access.
- Expose only required ports.
- Keep analytics services on private Docker networks where possible.
- Reserve storage capacity for databases, logs, and backup staging.
03
3. Deploy with Docker Compose
Review the compose file and images before starting them. Generate unique secrets, keep environment files out of Git, pin production image versions where the vendor supports it, and understand each persistent volume. Vectr4 customers can follow the Docker Compose installation guide.
04
4. Put HTTPS and a proxy in front
Terminate TLS at a reverse proxy or a carefully configured edge service. Preserve the real host and protocol headers, avoid caching ingestion requests, and set request-size and timeout limits that fit event payloads. If Cloudflare is in the path, use the Cloudflare deployment guide.
05
5. Verify collection end to end
A healthy container does not prove analytics works. Load the public dashboard, submit a known test event, inspect the network response, verify it reaches storage, and confirm that it appears in the intended event, session, journey, or funnel view. Document this smoke test so you can repeat it after updates.
06
6. Operate the system
Monitor certificate expiry, response errors, queue health, database storage, memory, CPU, and backup success. Test restoration rather than trusting backup completion messages. Apply updates in a controlled window and keep a rollback path.
- Follow the VPS analytics tutorial for a complete server checklist.
- Understand cookie and identifier tradeoffs in cookieless analytics explained.
- Review retention and delete data that no longer serves a defined purpose.
FAQ
Frequently asked questions
Is self-hosted analytics free?
Open-source software may have no license fee, but the deployment still has hosting, storage, backup, monitoring, maintenance, and engineering costs.
Can I self-host analytics on one VPS?
A single VPS can be practical for a small deployment. Capacity, availability, backup, and recovery requirements determine when services should be separated or scaled.
Does self-hosting make analytics private automatically?
No. Privacy depends on what you collect, how it is configured, who can access it, retention, external services, security, and applicable obligations.
What should I verify after deployment?
Verify the public dashboard, TLS, authentication, one known test event, storage, expected reports, backup creation, and a real restore procedure.