# evstats
**Repository Path**: mosongcc/evstats
## Basic Information
- **Project Name**: evstats
- **Description**: evstats
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 1
- **Forks**: 0
- **Created**: 2026-09-27
- **Last Updated**: 2026-10-02
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# evstats
**Self-hosted event analytics.** Collect with SDKs, look at the numbers in the dashboard, ask an Agent in plain language, pull them through an OpenAPI — all four are the same numbers, stored in your own ClickHouse.
[中文](README.md) · English · [Website](https://evstats.mosong.cc) · [Quick start (Chinese)](https://evstats.mosong.cc/zh/deploy/quickstart) · [Production (Chinese)](https://evstats.mosong.cc/zh/deploy/production) · [Live demo](https://evstats-dash-demo.mosong.cc) · [API reference](https://evstats.mosong.cc/zh/api/)

evstats stores page views and business events in your own ClickHouse: traffic, page, user, event and behavior analysis, boards, heatmaps, session replay, attribution, A/B tests, an Agent that queries the same tables as the charts, and a read-only OpenAPI — all in one open-source release with no licence switches. The documentation is in Chinese for now.
> The animations and screenshots on this page show the real interface with sample data generated by the automated tests.
## Four ways to use it
### Dashboard
Traffic, pages, users, events and behavior: more than thirty analysis pages. Dates, comparison and filters live in the address bar; every chart can switch to a table, export CSV and go on a board; every metric name explains how it is computed.
### Agent
Ask in plain language. The model can only call the same analysis queries as the charts — it never writes SQL. Every query is a card in the conversation that opens as the original chart. Works with any OpenAI-compatible Chat Completions model that supports tool calls and streaming.

### OpenAPI
A read-only `/api/v1` with an OpenAPI 3.0.3 contract. Parameters and response shapes are identical to the dashboard and share one result cache; API keys belong to users and see exactly the projects their user can see.

### SDKs
Web, Go and Java SDKs; anything else can post the HTTP protocol. Page views, clicks and dwell time are captured automatically, business events are tracked explicitly, and the ingest check shows what was received, what was dropped and why.

## Analytics included
Autocapture and custom events · referrers, UTM channels, search terms, regions and devices · realtime · event statistics with breakdowns · ordered funnels (2–8 steps) · retention · paths · user profiles · click and dwell heatmaps overlaid on your own pages · session replay · first / last / linear attribution · A/B tests with a z-test.
## Architecture
```mermaid
flowchart LR
src["Websites · servers · apps Web / Go / Java SDK, HTTP"] -->|POST /sa| collect
subgraph evstats["evstats: one binary, scale out behind a load balancer"]
collect["Ingest endpoint"]
ingest["Batch writer"]
kernel["Query kernel one set of metrics · result cache"]
dash["Dashboard /dash"]
agent["Agent"]
api["OpenAPI /api/v1"]
kernel --> dash
kernel --> agent
kernel --> api
end
collect -->|acknowledged once queued| redis[("Redis ingest queue · sessions · cache")]
redis -->|consumer group| ingest
ingest -->|ACK after insert| ch[("ClickHouse s0 + shards")]
kernel -->|project's shard| ch
dash --> people["Analysts"]
agent --> llm["Your model OpenAI-compatible"]
api --> biz["Business systems · external agents"]
```
## Quick start
On a machine with 2 cores, 4 GB RAM and Docker:
```bash
curl -fsSLO https://evstats.mosong.cc/deploy/compose/compose.yaml
# replace every change-me; keep the ClickHouse passwords identical, and the Redis passwords identical
docker compose up -d
```
Open `http://your-host:51321/`, create the admin and a project, then paste the Web SDK snippet shown on the project page:
```html
```
## Production
Run ClickHouse, Redis and evstats on separate servers, with Nginx terminating HTTPS in front of evstats. There is one Compose file per server in [deploy/production/](deploy/production); ClickHouse (8123) and Redis (6379) are only reachable from the evstats servers.
## Promises
- **Fully open source**: server, dashboard, SDKs and website, all Apache-2.0.
- **No feature switches**: no community, pro or enterprise editions, no licence server.
- **No official SaaS**: self-hosted software only.
- **No phoning home**: evstats never sends data to its authors. Self-telemetry is off by default and only goes to an address the admin configures.
- **Paid only for human services**: the chat group, consulting and managed operations never unlock features.
From v1.0: the ingest protocol and `/api/v1` only gain fields and paths; configuration keys keep their names; no new required environment variables; any 1.x upgrades directly to any later 1.x. Breaking any of these waits for 2.0.
## Repository
| Directory | Contents |
| --- | --- |
| [evs-aggr](evs-aggr) | Go server, binary `evstats` |
| [evs-dash](evs-dash) | Vue dashboard |
| [evs-docs](evs-docs) | Website and user documentation (VitePress) |
| [evs-sdks](evs-sdks) | Web, Go and Java SDKs |
| [evs-test](evs-test) | Automated test entry point (Python, uv) and website screenshots |
| [deploy](deploy) | Single-machine, production and multi-node Compose files, Nginx, systemd and the local development stack |
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md) and the [Code of Conduct](CODE_OF_CONDUCT.md). Report vulnerabilities privately as described in [SECURITY.md](SECURITY.md). Releases are listed in [CHANGELOG.md](CHANGELOG.md).
## License
[Apache License 2.0](LICENSE). Keep [LICENSE](LICENSE) and [NOTICE](NOTICE) when redistributing.