Matomo (formerly Piwik) is an open-source alternative to Google Analytics that you host yourself. Visitor data stays on your hosting, which helps with privacy regulations, and you can even track without cookies. Softaculous installs it in a couple of minutes; a few settings afterwards keep it fast and compliant.
Before you start
- A subdomain such as
stats.example.comwith a valid SSL certificate. See create a subdomain. - A supported PHP version with
pdo_mysql,gd,mbstringandxml;memory_limit256M or more. - Matomo suits small and medium sites on shared hosting. Very high-traffic sites generate a lot of data and are better on a VPS.
Install Matomo
- Open cPanel → Software → Softaculous Apps Installer, search Matomo (category Statistics) and click Install.
- Installation URL:
https://, the stats subdomain, empty directory. - Set the admin username, password and email, and the first website's name and URL.
- Click Install, then log in.
Add the tracking code
- In Matomo go to Administration (gear) → Websites → Tracking Code.
- Copy the JavaScript snippet and paste it before
</head>on every page of your site. - For WordPress, use the official Matomo integration plugin or a header-scripts plugin instead of editing theme files.
- Visit your site and check Visitors → Visits Log; your visit should appear within seconds.
Archive reports with cron
By default Matomo processes reports when someone opens the dashboard, which is slow. Use a cron job instead:
- In Administration → System → General settings, set Archive reports when viewed from the browser to No.
- Add a cPanel cron job every hour:
/usr/local/bin/php /home/cpuser/stats.example.com/console core:archive --url=https://stats.example.com/ > /dev/null 2>&1
Use the PHP binary of the site's version; see cron troubleshooting.
Privacy settings
- Administration → Privacy → Anonymize data: anonymise visitor IPs (2 bytes is common), and enable Delete old raw data after, for example, 180 days to keep the database small.
- Respect Do Not Track: enable it under Privacy → Users opt-out.
- Cookieless tracking: add
_paq.push(['disableCookies']);to the tracking code beforetrackPageView. Check your local regulations on whether you still need consent. - Add the Matomo opt-out form to your privacy policy page.
Tip: Exclude your own visits under Websites → Manage → Excluded IPs using your IP from the IP checker.
Keep it healthy
- Database size grows with traffic; check it in Manage My Databases and in Disk Usage.
- Enable minor auto-upgrades and take a backup before major updates.
- Ad blockers may block
matomo.js; that is normal and affects any analytics tool.
Troubleshooting
- No visits recorded: the tracking code is missing on the pages, or caching serves old HTML; purge your cache.
- Dashboard very slow: browser archiving is still on, or the cron job fails.
- Resource limit warnings: see resource usage.
