LIVEReading: Run Your Own Google Analytics Alternative in 30 MinTotal time: 10 minSteps: 6Worked first time: 72% LIVEReading: Run Your Own Google Analytics Alternative in 30 MinTotal time: 10 minSteps: 6Worked first time: 72%
CBW
Run Your Own Google Analytics Alternative in 30 Min
Mediumgithub.com/matomo-org/matomo2026-06-29

Run Your Own Google Analytics Alternative in 30 Min

Matomo is a self-hosted web analytics platform that keeps all visitor data on your own server. No data sent to Google, no third-party tracking, full GDPR control.

// Build stats

  • Total time10 min
  • Number of steps6
  • DifficultyMedium
  • Worked first time72%
// Before you start

What you need

  • A web server with PHP 7.2.5 or higher (shared hosting, VPS, or local server)
  • MySQL 5.5+ or MariaDB database available on that server
  • FTP/SFTP access or a file manager in your hosting control panel
  • A domain or subdomain pointing to your server (e.g. analytics.yoursite.com)
  • Access to create a MySQL database (most cPanel hosts have this)
01
Step 1 of 6

Download the Matomo zip file

2 min

You need to grab the latest stable Matomo package from the official site. This is a single zip file containing all the PHP files Matomo needs. You do not need Git or any developer tools — just a browser and a way to upload files to your server.

Terminal · mac
$ curl -O https://builds.matomo.org/matomo-latest.zip
What you should see
A file named matomo-latest.zip appears in your current folder. If you are not using a terminal, visit https://matomo.org/download/ in your browser and click the Download button instead.
This might happen

curl not available on Windows without extra setup

Just download the zip directly from https://matomo.org/download/ using your browser — no terminal needed.

02
Step 2 of 6

Upload and unzip Matomo on your server

5 min

Extract the zip file and upload the resulting 'matomo' folder to your web server's public directory (often called public_html, www, or htdocs). If your hosting panel has a File Manager, you can upload the zip there and extract it directly on the server — that is faster than uploading thousands of small files over FTP.

Terminal · mac
$ unzip matomo-latest.zip && mv matomo /var/www/html/matomo
What you should see
A folder called 'matomo' now exists inside your web root. Visiting http://yourdomain.com/matomo in a browser should show a Matomo setup page — not a blank screen or 404.
This might happen

Blank page or 403 Forbidden error after uploading

Check that the matomo folder is inside your public web root (public_html or similar), not one level above it. Also confirm file permissions — the matomo folder should be readable by the web server (chmod 755 on folders, 644 on files).

03
Step 3 of 6

Create a MySQL database for Matomo

3 min

Matomo stores all your analytics data in a MySQL database. You need to create an empty database and a database user with full permissions on it before running the installer. On most shared hosts, you do this inside cPanel under 'MySQL Databases'. Write down the database name, username, and password — you will need them in the next step.

Terminal · mac
$ mysql -u root -p -e "CREATE DATABASE matomo_db; CREATE USER 'matomo_user'@'localhost' IDENTIFIED BY 'StrongPassword123'; GRANT ALL PRIVILEGES ON matomo_db.* TO 'matomo_user'@'localhost'; FLUSH PRIVILEGES;"
What you should see
No errors returned. If you used cPanel, you will see the new database and user listed on the MySQL Databases page.
This might happen

Access denied error when running the MySQL command

You may not have root MySQL access on shared hosting. Use your hosting control panel's MySQL Databases tool instead — it does the same thing through a web interface.

04
Step 4 of 6

Run the web-based installer

5 min

Matomo has a point-and-click installer that runs entirely in your browser. Open the URL where you uploaded Matomo and follow the on-screen steps. You will enter your database credentials, create an admin account, and add the first website you want to track. The installer checks your server requirements automatically and will flag any missing PHP extensions.

Terminal · mac
$ Open your browser and go to: http://yourdomain.com/matomo/
What you should see
You see the Matomo installation wizard. After completing all steps (usually 8 screens), you land on a 'Congratulations' page with a JavaScript tracking code snippet.
This might happen

Installer reports missing PHP extensions (pdo_mysql, mbstring, etc.)

Contact your hosting provider and ask them to enable the listed PHP extensions, or switch to a PHP version in your control panel that has them enabled. Most modern shared hosts support all required extensions by default.

05
Step 5 of 6

Add the tracking code to your website

3 min

At the end of the installer, Matomo gives you a small JavaScript snippet. Copy it and paste it into every page of your website, just before the closing </head> tag. If you use WordPress, install the 'Matomo Analytics' plugin from the WordPress plugin directory — it adds the code automatically without touching any files.

Terminal · mac
$ Paste the JavaScript snippet Matomo gave you into your site's HTML, just before </head>. Example of what it looks like:
$
$ <!-- Matomo -->
$ <script>
$ var _paq = window._paq = window._paq || [];
$ _paq.push(['trackPageView']);
$ _paq.push(['enableLinkTracking']);
$ (function() {
$ var u="//yourdomain.com/matomo/";
$ _paq.push(['setTrackerUrl', u+'matomo.php']);
$ _paq.push(['setSiteId', '1']);
$ var d=document, g=d.createElement('script'),
$ s=d.getElementsByTagName('script')[0];
$ g.async=true; g.src=u+'matomo.js';
$ s.parentNode.insertBefore(g,s);
$ })();
$ </script>
$ <!-- End Matomo Code -->
What you should see
After visiting your website once, go to your Matomo dashboard. Within a minute or two you should see a real-time visit appear under Visitors > Real-time.
This might happen

No visits showing up after adding the code

Check that your browser is not blocking the matomo.js script with an ad blocker. Try visiting your site in a private window with extensions disabled. Also confirm the tracking code URL matches your actual Matomo installation URL.

06
Step 6 of 6

Set up automatic archiving (recommended)

5 min

By default Matomo processes reports on-demand when you open the dashboard, which can be slow for busy sites. Setting up a cron job tells your server to pre-process reports every hour in the background. Most cPanel hosts let you add cron jobs under 'Cron Jobs' in the control panel. Paste the command below and set it to run every hour.

Terminal · mac
$ 5 * * * * /usr/bin/php /var/www/html/matomo/console core:archive --url=http://yourdomain.com/matomo/ > /dev/null 2>&1
What you should see
No immediate output — cron jobs run silently. After an hour, your Matomo dashboard should load noticeably faster and show fully processed reports.
This might happen

Wrong path to php or to the matomo folder

Run 'which php' in your terminal to find the correct PHP path. Replace /var/www/html/matomo with the actual path where you uploaded Matomo. Your hosting panel's cron tool may also let you browse to the file.

// Status

cooked. baked. worked.

A fully working, self-hosted analytics dashboard at your own domain. You own 100% of the data, no data leaves your server, and you can track unlimited websites for free.

// the honest bit

The honest part

Matomo is a real server application, not a one-click SaaS tool. You need a PHP/MySQL web host — it will not run on a laptop without extra setup like XAMPP or Docker. Shared hosting works fine for low-to-medium traffic sites. For high-traffic sites (millions of visits/month) you will eventually need a VPS and some server tuning. Many premium features (heatmaps, session recordings, A/B testing) require paid plugins from the Matomo Marketplace. The free core is genuinely powerful, but the plugin store can add up quickly.