Swetrix is an open source, privacy-focused alternative to Google Analytics designed for developers and businesses seeking full control over their web analytics data. Built with a cookieless tracking script and GDPR-compliant by design, it provides real-time insights into traffic, user sessions, performance metrics, and client-side errors without compromising user privacy. Swetrix offers both a fully managed cloud service hosted in Germany and a self-hostable Community Edition, allowing users to choose between convenience and complete data sovereignty.
The platform is built for technical teams that need actionable web analytics—without third-party tracking, vendor lock-in, or data resale. Whether you’re a solo developer managing a blog or an engineering team monitoring a SaaS product, Swetrix delivers core analytics features like geolocation, UTM tracking, session replay, funnels, and performance monitoring—all while keeping data anonymized and under your control.
What You Get
- Cookieless tracking - Swetrix uses a lightweight JavaScript tracker that collects analytics without cookies, localStorage, or fingerprinting, ensuring GDPR compliance and user privacy by default.
- Real-time dashboard - Visualize traffic trends, top pages, devices, and traffic sources with interactive charts powered by billboard.js and a React-based UI.
- Custom events and properties - Track user actions like button clicks, form submissions, or purchases with custom event names and JSON properties for deeper insights.
- Session analytics & user flows - Understand how users navigate your site by visualizing session paths and identifying common navigation patterns.
- Funnels - Define multi-step conversion goals (e.g., signup → payment) and visualize drop-off points to optimize user journeys.
- Performance monitoring - Measure real-user metrics including TTFB, DNS resolution, TLS handshake, and render time to identify speed bottlenecks.
- Error tracking - Automatically capture and aggregate client-side JavaScript errors with stack traces, browser info, and URL context.
- Geolocation mapping - View user distribution on a map with country-level data; Cloud users benefit from premium GeoIP accuracy, while self-hosted users rely on DB-IP City Lite.
- UTM campaign tracking - Automatically parse and visualize traffic sources from UTM parameters for marketing analysis.
- Data export & API access - Export all analytics data to CSV and programmatically retrieve metrics via the documented Statistics API.
- Self-hostable with Docker - Deploy the full stack using Docker Compose with MySQL for metadata, ClickHouse for analytics, and Redis for caching.
- Public and password-protected dashboards - Share project insights via public links or password-protected URLs without requiring user accounts in the Community Edition.
- Project-level access control - Invite team members to specific projects with role-based permissions in Cloud; self-hosted supports basic project sharing via links.
Common Use Cases
- Building a GDPR-compliant analytics stack - A European SaaS startup replaces Google Analytics with Swetrix to avoid regulatory risk, using the self-hosted version on their private server to retain full control over user data.
- Monitoring a high-traffic blog with performance insights - A content creator tracks page load times and JavaScript errors across devices to improve UX, using Swetrix’s real-time performance metrics without cookie consent banners.
- Tracking conversion funnels for an e-commerce product page - An online retailer defines a funnel from ‘product view’ → ‘add to cart’ → ‘purchase’ and uses Swetrix’s funnel visualization to identify where users drop off.
- DevOps teams managing microservices with embedded analytics - A team deploying a React-based frontend service uses Swetrix to monitor real-user performance and errors across multiple regions, exporting data for internal dashboards.
- Replacing Google Analytics in a privacy-sensitive industry - A healthcare platform removes third-party analytics and implements Swetrix to comply with HIPAA-like privacy standards, using the cloud version for ease of maintenance.
- Solo developers seeking simple, self-hosted stats - A developer runs a personal blog and uses the Docker-based Community Edition to track visits, top pages, and referrers without relying on external services.
Under The Hood
Swetrix is a comprehensive web analytics and monitoring platform built with a modular monolithic architecture that combines NestJS backend services, React frontend components, and AI-powered features. The system emphasizes domain-driven design and clear separation of concerns across its various functional modules.
Architecture
Swetrix follows a structured monorepo approach with distinct backend apps and frontend components, enabling scalable and maintainable development.
- The system is organized as a NestJS-based monorepo with multiple apps handling analytics, authentication, and AI domains
- Modules are designed around domain boundaries, ensuring clear separation between services like alerts, admin tools, and session tracking
- Dependency injection and layered architecture support decoupled and testable components
- Communication between services is handled through APIs, WebSocket gateways, and centralized configuration
Tech Stack
Built with modern TypeScript and JavaScript frameworks, the platform leverages a rich ecosystem of tools for full-stack development.
- The backend is powered by NestJS and TypeScript, while the frontend uses React for a responsive admin interface
- Core dependencies include TypeORM, MySQL, Clickhouse, and various utility libraries for data processing and internationalization
- Development tools encompass Docker, Knip, Oxfmt, and Oxlint for containerization, dependency management, and code formatting
- Testing and monitoring tools like Sentry and ts-prune are integrated to ensure code quality and error tracking
Code Quality
Code quality in Swetrix reflects a balanced approach with consistent use of TypeScript and NestJS patterns, though not without some technical debt.
- The codebase maintains reasonable error handling and follows TypeScript best practices for type safety
- Test coverage is limited, with a focus on backend services but minimal frontend or integration testing
- Code consistency is evident in component structure and module organization, though some stylistic improvements remain
- Modular design supports maintainability but includes areas where code duplication and complexity could be reduced
What Makes It Unique
Swetrix distinguishes itself through its integration of AI features and modular architecture within a web analytics context.
- The platform embeds AI chat functionality directly into its analytics dashboards for intelligent query processing
- Custom event tracking and heartbeat monitoring provide real-time session insights not commonly found in standard analytics tools
- Decorators and validation layers simplify API security and data integrity checks across endpoints
- Modular monorepo design allows independent development of admin UI and backend services, supporting flexible deployment strategies