https://github.com/livrasand/ethicalmetrics
A privacy-focused, open-source web analytics platform designed as a powerful alternative to Google Analytics. Powered by an active community dedicated to ethical data tracking.
https://github.com/livrasand/ethicalmetrics
alternative analytics charts cloud-native ethical-analytics ethical-metrics gdpr go golang google-analytics google-analytics-alternative marketing metrics open-source product-analytics real-time self-hosted selfhosted statistics web-analytics
Last synced: 5 months ago
JSON representation
A privacy-focused, open-source web analytics platform designed as a powerful alternative to Google Analytics. Powered by an active community dedicated to ethical data tracking.
- Host: GitHub
- URL: https://github.com/livrasand/ethicalmetrics
- Owner: livrasand
- License: gpl-3.0
- Created: 2025-06-23T21:52:06.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2026-01-26T23:22:25.000Z (5 months ago)
- Last Synced: 2026-02-06T03:50:00.211Z (5 months ago)
- Topics: alternative, analytics, charts, cloud-native, ethical-analytics, ethical-metrics, gdpr, go, golang, google-analytics, google-analytics-alternative, marketing, metrics, open-source, product-analytics, real-time, self-hosted, selfhosted, statistics, web-analytics
- Language: HTML
- Homepage: https://ethicalmetrics.leapcell.app
- Size: 36.3 MB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Citation: CITATION.cff
- Roadmap: ROADMAP.md
Awesome Lists containing this project
README
# EthicalMetrics
[](https://deepwiki.com/livrasand/EthicalMetrics) [](https://doi.org/10.5281/zenodo.16121940) [](https://goreportcard.com/report/github.com/livrasand/ethicalmetrics) [](https://crowdin.com/project/ethicalmetrics)
**EthicalMetrics** was born from a simple frustration: every time we implemented Google Analytics, we felt like we were betraying our users' trust.
**What if analytics could be both powerful AND ethical?**
EthicalMetrics is our answer - a next-generation web analytics platform that delivers meaningful insights while **protecting your users' privacy as a fundamental right, not an afterthought.**
No cookies. No fingerprinting. No personal data. No compromises.
> [!IMPORTANT]
> EthicalMetrics is in a pre-alpha state, and only suitable for use by developers
>
---
## Why EthicalMetrics?
- **True Anonymity by Design**
No IP collection. No device fingerprinting. No persistent IDs.
100% anonymous, with no way to track individual users — by default.
- **Self-Hosted, Zero External Dependencies**
No third-party scripts, CDNs, or vendors. You own your data.
- **End-to-End Encryption**
Data is protected at rest using Redis. Built-in, not bolted on.
- **Core, Actionable Metrics**
Track visits, module usage, performance, events, and engagement — not people.
- **Lightweight & Easy to Use**
A single vanilla JS snippet. No frameworks. No bloat.
Ethical by default — even without configuration.
- **Flexible Open API**
Send custom events and modules programmatically with minimal overhead.
- **Private Dashboards per Site**
Each site has its own dashboard secured with token-based access.
- **Portable by Nature**
Works on VPS, Docker, Render, or local environments. No lock-in.
EthicalMetrics exists to prove that **analytics can be useful without being creepy.**
👉 [Read the Ethical Analytics Manifesto in `FUNDAMENTALS.md`](./FUNDAMENTALS.md)
EthicalMetrics is growing fast — without compromising ethics.
👉 [Check out the roadmap here](./ROADMAP.md)
## Why This Matters
In a world where **96% of websites** track users without consent, EthicalMetrics represents a different path forward:
- **For Developers**: Build with confidence knowing you're respecting user privacy
- **For Businesses**: Gain insights without legal compliance headaches (GDPR, CCPA ready)
- **For Users**: Browse freely without being surveilled and profiled
- **For the Web**: Help create an internet that serves people, not advertisers
*Join thousands of developers who are choosing ethics over surveillance capitalism.*
---
## Architecture Overview
Understanding how EthicalMetrics works internally helps you make the most of its privacy-first approach. The following diagrams illustrate the system's core components and data flow.
### System Architecture
The complete EthicalMetrics system consists of four main layers working together:
```mermaid
flowchart TD
%% Clusters/Groups
subgraph Client_Layer
Website["Website Integration"]
ethicalmetrics_js["ethicalmetrics.js"]
end
subgraph Web_Interface
nuevo_html["pricing.html"]
dashboard_html["dashboard.html"]
index_html["index.html"]
end
subgraph Server_Layer
main_go["cmd/server/main.go"]
handlers_go["internal/api/handlers.go"]
end
subgraph Data_Layer
database_go["internal/db/database.go"]
event_go["internal/models/event.go"]
metrics_db["Redis"]
sites_table["sites"]
events_table["events"]
end
%% Connections
Website --> ethicalmetrics_js
ethicalmetrics_js -.-> handlers_go
dashboard_html -.-> handlers_go
index_html -.-> handlers_go
main_go --> handlers_go
main_go --> nuevo_html
main_go --> dashboard_html
main_go --> index_html
handlers_go --> database_go
handlers_go --> event_go
database_go --> metrics_db
metrics_db --> sites_table
metrics_db --> events_table
%% Style for dotted lines
linkStyle 2,3,4 stroke:#999,stroke-dasharray:3
```
### User Workflow
EthicalMetrics follows a simple three-stage process from registration to analytics:
```mermaid
flowchart TD
%% Main Nodes
START["Website Owner Starts"]
REGISTER["Site Registration"]
INTEGRATE["Client Integration"]
ANALYTICS["View Analytics"]
NUEVO_HANDLER["/nuevo API Endpoint"]
TRACK_HANDLER["/track API Endpoint"]
STATS_HANDLER["/stats API Endpoint"]
REDIS_SITES["Redis Sites Storage"]
REDIS_EVENTS["Redis Events Storage"]
QUERY_DATA["Query aggregated data"]
SITE_ID["site_id + admin_token"]
EVENT_STORAGE["Anonymous Event Storage"]
DASHBOARD_DATA["por_modulo + por_dia stats"]
%% Connections
START --> REGISTER
REGISTER --> INTEGRATE
REGISTER --> NUEVO_HANDLER
INTEGRATE --> ANALYTICS
INTEGRATE --> TRACK_HANDLER
ANALYTICS --> STATS_HANDLER
NUEVO_HANDLER --> REDIS_SITES
TRACK_HANDLER --> REDIS_EVENTS
STATS_HANDLER --> QUERY_DATA
REDIS_SITES --> SITE_ID
REDIS_EVENTS --> EVENT_STORAGE
QUERY_DATA --> DASHBOARD_DATA
%% Styling for better visualization
classDef process fill:#e1f5fe,stroke:#039be5
classDef storage fill:#e8f5e9,stroke:#43a047
classDef endpoint fill:#fff3e0,stroke:#fb8c00
classDef data fill:#f3e5f5,stroke:#8e24aa
class START,REGISTER,INTEGRATE,ANALYTICS process
class NUEVO_HANDLER,TRACK_HANDLER,STATS_HANDLER endpoint
class REDIS_SITES,REDIS_EVENTS,QUERY_DATA storage
class SITE_ID,EVENT_STORAGE,DASHBOARD_DATA data
```
### API Endpoints
The system exposes three main API endpoints that handle all core functionality:
```mermaid
flowchart TD
%% Clusters/Groups
subgraph HTTP_Endpoints
track_endpoint["/track"]
nuevo_endpoint["/nuevo"]
stats_endpoint["/stats"]
static_endpoint["/static/*"]
end
subgraph Handler_Functions
TrackHandler["TrackHandler"]
NuevoHandler["NuevoHandler"]
StatsHandler["StatsHandler"]
StaticHandler["http.FileServer"]
end
subgraph Database_Operations
InsertEvent["INSERT INTO events"]
InsertSite["INSERT INTO sites"]
SelectStats["SELECT aggregated data"]
end
subgraph Response_Data
EventModel["models.Event"]
SiteResponse["site_id + admin_token"]
StatsResponse["por_modulo + por_dia"]
end
%% Connections
track_endpoint --> TrackHandler
nuevo_endpoint --> NuevoHandler
stats_endpoint --> StatsHandler
static_endpoint --> StaticHandler
TrackHandler --> InsertEvent
NuevoHandler --> InsertSite
StatsHandler --> SelectStats
InsertEvent --> EventModel
InsertSite --> SiteResponse
SelectStats --> StatsResponse
%% Styling
classDef endpoint fill:#e3f2fd,stroke:#1976d2
classDef handler fill:#e8f5e9,stroke:#388e3c
classDef db_operation fill:#fff3e0,stroke:#ffa000
classDef response fill:#f3e5f5,stroke:#8e24aa
class HTTP_Endpoints endpoint
class Handler_Functions handler
class Database_Operations db_operation
class Response_Data response
```
# Algorithms
**Average session duration:**
```math
\bar{D} = \frac{1}{N} \sum _{i=1}^{N} d_i \quad \text{(where } d_i > 0\text{)}
```
---
**Weekly comparison:**
```math
W_{\text{current}}[d] = \sum _{e \in E_{\text{current}}} \mathbb{I}(\text{day}(e) = d)
```
---
**Retention per page:**
```math
R_p = \left| \{ \text{date}(e) \mid e \in E_p \} \right|
```
---
**Token Generation**
```math
\text{Token} = \bigoplus _{i=1}^{24} \text{charset}[\lfloor 62 \cdot U(0,1) \rfloor]
```
---
## 🚀 Get Started in 60 Seconds
### Step 1: Get Your Credentials
Visit [ethicalmetrics.onrender.com](https://ethicalmetrics.leapcell.app) and click "Create Account" - no email required!
### Step 2: Add One Line of Code
```html
```
### Step 3: View Your Analytics
Access your private dashboard instantly - that's it! 🎉
Want advanced features? [Sponsor the project](https://github.com/sponsors/livrasand) for early access to Professional analytics tools.
**Ultra-simple banner customization:**
You can easily customize the consent banner by adding `data-*` attributes to the script tag:
```html
```
**Domain restriction banner customization:**
If the tracker is used on a non-registered domain, it can show a warning banner. You can customize it using:
```html
```
Change colors and text as you wish — no coding required!
4. Optionally, define a custom module for richer context:
```html
...
```
5. Access your private dashboard:
```
https://ethicalmetrics.leapcell.app/dashboard.html?site=YOUR_SITE_ID&token=YOUR_ADMIN_TOKEN
```
---
## Join the Movement
EthicalMetrics is more than software - it's a statement that **privacy and analytics can coexist**.
### Ways to Contribute:
- 💰 **[Sponsor the project](https://github.com/sponsors/livrasand)** - Fund development and get exclusive access
- 🐛 **[Report issues](https://github.com/livrasand/EthicalMetrics/issues)** - Help us improve
- 🔧 **[Submit PRs](https://github.com/livrasand/EthicalMetrics/pulls)** - Code contributions welcome
- 🌍 **[Help translate](https://crowdin.com/project/ethicalmetrics)** - Make it accessible worldwide. Some of these translations are done by AI, which may not be of the highest quality.
- 📢 **Spread the word** - Share with fellow privacy advocates
**Every contribution helps build a more ethical web.**
Made with 💚 by [@livrasand](https://github.com/livrasand).
---
**🛡️ Ethical by design. Anonymous by default. Metrics with ethics. Do EthicalMetrics!**
## License
This project is available under a dual license model:
- **GNU GPL v3** for personal, educational, or compatible open source use.
- **EthicalMetrics Commercial License** for commercial, SaaS, or proprietary products.
For a commercial license, see [`LICENSE-COMMERCIAL.md`](./LICENSE-COMMERCIAL.md).
### Cite this project
If you use EthicalMetrics in research or documentation, please cite it as follows:
> Sandoval, L. (2025). livrasand/EthicalMetrics: v0.1.0-alpha (v0.1.0-alpha). Zenodo. https://doi.org/10.5281/zenodo.16121940