# matomo-org/matomo architecture

> Architecture diagram of the GitHub repository matomo-org/matomo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/matomo-org/matomo
- Repository: https://github.com/matomo-org/matomo

## Overview

Matomo is a self-hosted analytics platform: website tracking data is collected and stored, then exposed as reports through its API and interface. The README also identifies privacy controls, customizable dashboards, and plugin-based features such as goals and ecommerce. The graph includes those documented capabilities; some runtime wiring is dashed because the sampled excerpts do not show the relevant calls.

Main entry points: [`plugins/API/Controller.php`](https://github.com/matomo-org/matomo/blob/6.x-dev/plugins/API/Controller.php) (Analytics API), [`core/Plugin/Manager.php`](https://github.com/matomo-org/matomo/blob/6.x-dev/core/Plugin/Manager.php) (Plugin system), [`core/FrontController.php`](https://github.com/matomo-org/matomo/blob/6.x-dev/core/FrontController.php) (Front controller), [`core/API/Request.php`](https://github.com/matomo-org/matomo/blob/6.x-dev/core/API/Request.php) (API request)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Request entry"]
  node_front["Front controller"]
  node_api_request["API request<br/>[Request.php]"]
end

subgraph group_tracking["Analytics collection"]
  node_tracker["Tracking handler<br/>[Handler.php]"]
  node_visit["Visit processing<br/>[Factory.php]"]
  node_goal["Goal tracking<br/>[GoalManager.php]"]
  node_logdb[("Analytics database<br/>[RawLogDao.php]")]
end

subgraph group_reporting["Analytics reports"]
  node_api["Analytics API<br/>[Controller.php]"]
  node_archive[("Report archives<br/>[Archive.php]")]
  node_datatable["Report tables<br/>[DataTable.php]"]
  node_dashboard["Dashboard UI<br/>[Controller.php]"]
end

subgraph group_platform["Platform features"]
  node_plugins["Plugin system<br/>[Manager.php]"]
  node_privacy["Privacy controls<br/>[PrivacyManager.php]"]
  node_sites["Site management<br/>[SitesManager.php]"]
end

node_website(("Tracked website"))
node_browser(("Browser user"))

node_website -.->|"sends tracking"| node_tracker
node_tracker -.->|"processes visits"| node_visit
node_visit -.->|"stores events"| node_logdb
node_goal -.->|"records conversions"| node_logdb
node_browser -.->|"requests pages"| node_front
node_front -->|"routes API"| node_api_request
node_api_request -.->|"dispatches methods"| node_api
node_api -.->|"returns reports"| node_archive
node_api -.->|"formats results"| node_datatable
node_dashboard -.->|"requests reports"| node_api
node_plugins -.->|"provides extensions"| node_goal
node_plugins -.->|"loads features"| node_privacy
node_plugins -.->|"loads features"| node_sites

click node_front "https://github.com/matomo-org/matomo/blob/6.x-dev/core/FrontController.php"
click node_api_request "https://github.com/matomo-org/matomo/blob/6.x-dev/core/API/Request.php"
click node_tracker "https://github.com/matomo-org/matomo/blob/6.x-dev/core/Tracker/Handler.php"
click node_visit "https://github.com/matomo-org/matomo/blob/6.x-dev/core/Tracker/Visit/Factory.php"
click node_goal "https://github.com/matomo-org/matomo/blob/6.x-dev/core/Tracker/GoalManager.php"
click node_logdb "https://github.com/matomo-org/matomo/blob/6.x-dev/core/DataAccess/RawLogDao.php"
click node_api "https://github.com/matomo-org/matomo/blob/6.x-dev/plugins/API/Controller.php"
click node_archive "https://github.com/matomo-org/matomo/blob/6.x-dev/core/Archive.php"
click node_datatable "https://github.com/matomo-org/matomo/blob/6.x-dev/core/DataTable.php"
click node_dashboard "https://github.com/matomo-org/matomo/blob/6.x-dev/plugins/Dashboard/Controller.php"
click node_plugins "https://github.com/matomo-org/matomo/blob/6.x-dev/core/Plugin/Manager.php"
click node_privacy "https://github.com/matomo-org/matomo/blob/6.x-dev/plugins/PrivacyManager/PrivacyManager.php"
click node_sites "https://github.com/matomo-org/matomo/blob/6.x-dev/plugins/SitesManager/SitesManager.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_front,node_api_request,node_browser toneBlue
class node_tracker,node_visit,node_goal,node_logdb toneAmber
class node_api,node_archive,node_datatable,node_dashboard toneMint
class node_plugins,node_privacy,node_sites toneRose
class node_website toneIndigo
```

## Components

### Request entry

- [Front controller](https://github.com/matomo-org/matomo/blob/6.x-dev/core/FrontController.php): `core/FrontController.php`
- [API request](https://github.com/matomo-org/matomo/blob/6.x-dev/core/API/Request.php): `core/API/Request.php`

### Analytics collection

- [Tracking handler](https://github.com/matomo-org/matomo/blob/6.x-dev/core/Tracker/Handler.php): `core/Tracker/Handler.php`
- [Visit processing](https://github.com/matomo-org/matomo/blob/6.x-dev/core/Tracker/Visit/Factory.php): `core/Tracker/Visit/Factory.php`
- [Goal tracking](https://github.com/matomo-org/matomo/blob/6.x-dev/core/Tracker/GoalManager.php): `core/Tracker/GoalManager.php`
- [Analytics database](https://github.com/matomo-org/matomo/blob/6.x-dev/core/DataAccess/RawLogDao.php): `core/DataAccess/RawLogDao.php`

### Analytics reports

- [Analytics API](https://github.com/matomo-org/matomo/blob/6.x-dev/plugins/API/Controller.php): `plugins/API/Controller.php`
- [Report archives](https://github.com/matomo-org/matomo/blob/6.x-dev/core/Archive.php): `core/Archive.php`
- [Report tables](https://github.com/matomo-org/matomo/blob/6.x-dev/core/DataTable.php): `core/DataTable.php`
- [Dashboard UI](https://github.com/matomo-org/matomo/blob/6.x-dev/plugins/Dashboard/Controller.php): `plugins/Dashboard/Controller.php`

### Platform features

- [Plugin system](https://github.com/matomo-org/matomo/blob/6.x-dev/core/Plugin/Manager.php): `core/Plugin/Manager.php`
- [Privacy controls](https://github.com/matomo-org/matomo/blob/6.x-dev/plugins/PrivacyManager/PrivacyManager.php): `plugins/PrivacyManager/PrivacyManager.php`
- [Site management](https://github.com/matomo-org/matomo/blob/6.x-dev/plugins/SitesManager/SitesManager.php): `plugins/SitesManager/SitesManager.php`

### Other components

- **Tracked website**
- **Browser user**

## Connections

- Tracked website → Tracking handler: sends tracking
- Tracking handler → Visit processing: processes visits
- Visit processing → Analytics database: stores events
- Goal tracking → Analytics database: records conversions
- Browser user → Front controller: requests pages
- Front controller → API request: routes API (evidence: `core/FrontController.php`)
- API request → Analytics API: dispatches methods
- Analytics API → Report archives: returns reports
- Analytics API → Report tables: formats results
- Dashboard UI → Analytics API: requests reports
- Plugin system → Goal tracking: provides extensions (evidence: `core/Tracker/GoalManager.php`)
- Plugin system → Privacy controls: loads features
- Plugin system → Site management: loads features (evidence: `core/Plugin/Manager.php`)
