Matomo
A self-hosted web analytics platform for visits, events, campaigns, goals, ecommerce, consent, and privacy controls.
Why consider Matomo?
Matomo is an open-source digital analytics platform that gives organizations full data ownership and privacy compliance. It provides complete web analytics, tag management, and visitor reporting as a self-hosted alternative to Google Analytics.
Learn Matomo by building
Practical setup notes, real use cases, and copy-ready examples in one focused guide.
In this guide3 sections
Deploying and Configuring Matomo Analytics for Self-Hosted Tracking
Digital analytics platforms allow organizations to evaluate audience engagement, traffic sources, and user journeys across their online services. According to the Matomo Project README, Matomo is a full-featured PHP MySQL software program that you download and install on your own webserver. This architecture enables self-hosted operations without depending on external proprietary measurement platforms.
Organizations with strict data governance policies frequently replace third-party cloud trackers with self-managed software. As documented in the official README, Matomo aims to be a Free software alternative to Google Analytics and is already used on more than 1,400,000 websites. This widespread adoption reflects demand for open analytics platforms that respect user privacy.
Server Prerequisites and Environment Setup
Preparing the host environment requires verifying PHP runtime versions and compatible database extensions. According to the Matomo requirements documentation, Matomo 4.x requires PHP version 7.2.5 or greater. Matomo 4.16 and Matomo 5 work well with PHP 8. Verifying these runtime versions ensures that standard database connectors and core processing libraries function as expected.
When provisioning servers for high-volume analytics workloads, selecting an optimal PHP interpreter version improves processing throughput. As highlighted in the requirements guide, We recommend using the latest PHP 8.x release as it is more memory efficient and faster than previous PHP versions. Installing required extensions on Debian or Ubuntu systems can be performed with the following package command:
sudo apt-get install php php-curl php-gd php-cli mysql-server php-mysql php-xml php-mbstringDatabase user accounts must have adequate administrative privileges to create and modify analytical tables during installation and schema migrations. The Matomo requirements documentation states that The MySQL USER should have the permission to SELECT, INSERT, UPDATE, DELETE, CREATE, INDEX, DROP, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, FILE. Configuring these specific database privileges prevents schema initialization failures during first-time deployment.
On-Premise Installation and Archive Deployment
Deploying the on-premise application begins by obtaining the release package and transferring it to the hosting infrastructure. As detailed in the Matomo installation documentation, Upload the files to your server using SSH (SCP/SFTP). SSH-based methods encrypt data during transfer, which protects credentials and files from interception. If shell access is available, administrators can retrieve and extract the official archive with the following commands:
wget https://builds.matomo.org/matomo.zipunzip matomo.zipOnce archive contents are unpacked into the web server document root, establishing restrictive filesystem permissions protects system integrity. As documented in the Matomo installation guide, Setting correct file permissions helps protect your Matomo installation and prevent runtime errors. After completing initial setup, write permissions should be tightly restricted to only directories that require runtime updates.
Maintaining a secure installation involves locking down configuration files while allowing background processes to operate normally. According to the official installation documentation, There are only two places where Matomo will need to write files: 1. the matomo/tmp/ folder 2. the matomo/js/piwik.js and matomo/js/matomo.js files. Keeping other directories read-only prevents unauthorized modifications to core application code.
Client Integration and Measurement Features
Integrating client-side analytics into web applications requires embedding the tracking snippet within rendered HTML templates. The Matomo JavaScript tracking guide explains that You can use the JavaScript tracking client to track any application that supports JavaScript: for example websites! Once embedded, the tracking script records page views, referrers, and user interactions in real time.
Broad browser support is necessary to ensure consistent visitor telemetry across varied desktop and mobile environments. According to the official JavaScript guide, The JavaScript tracker runs on all browsers that support the JSON API. This includes IE8 and higher. This broad compatibility ensures that legacy and modern client devices are accurately captured in reporting datasets.
Standard analytics setups often record visit durations inaccurately when visitors leave after viewing only a single page. As detailed in the JavaScript tracking documentation, You can enable the Heartbeat Timer to improve visit duration tracking by sending a heartbeat ping when the visitor leaves or hides the page. Enabling this ping provides more realistic session duration metrics without artificially generating extra page view events.
Project maintenance and ongoing releases deliver security patches, compliance updates, and analytical enhancements. As noted in the Matomo Project README, Matomo is the leading Free/Libre open analytics platform. Furthermore, the repository at Matomo on GitHub and releases such as Matomo release 5.14.0-alpha.20260822013241 provide continuous updates for self-hosted instances.
Related tools
More options with a similar category or technology profile.
ActivityWatch
The leading privacy-first, open-source automated time and application tracker.
Traggo
Tag-based time tracking server with visual statistics and dashboards.
Prefect
Prefect is a Python workflow orchestration framework.
Apache Airflow
Apache Airflow is a platform for authoring, scheduling, and monitoring batch workflows as Python DAGs.