Matomo

Matomo is an open-source web analytics platform. It gives you full ownership of your visitor data with no third-party data sharing. It supports dashboards, goals, funnels, heatmaps, event tracking, and GDPR-compliant data collection.

Getting Started

Go to Matomo on OSC to create your instance.

Prerequisites

  • An OSC account (sign up at app.osaas.io)
  • Optionally: an external MySQL/MariaDB database for production use

Step-by-Step Setup

Basic Setup (Built-in Database)

For quick evaluation, create Matomo without specifying database connection details. Matomo will use its own bundled storage:

osc create matomo-org-matomo mymatomo

Production Setup with External Database

For production, connect Matomo to a MariaDB or MySQL instance for persistent data storage:

  1. Create a MariaDB instance:
osc create linuxserver-docker-mariadb mymariadb \
  -o Password="{{secrets.mariadb-password}}" \
  -o Database="matomo"
  1. Create the Matomo instance with database connection details:
osc create matomo-org-matomo mymatomo \
  -o DatabaseHost="mymariadb.auto.prod.osaas.io" \
  -o DatabaseAdapter="PDO_MYSQL" \
  -o DatabaseUsername="user" \
  -o DatabasePassword="{{secrets.mariadb-password}}" \
  -o DatabaseDbName="matomo" \
  -o DatabaseTablesPrefix="matomo_"

Step 3: Run the Setup Wizard

Navigate to your Matomo URL and follow the Installation Wizard:

  1. System check — verifies PHP requirements
  2. Database setup — enter your database credentials (or confirm auto-detection)
  3. Create your first super user account
  4. Add your first website to track

Default credentials: No pre-set defaults. You create your admin account in the setup wizard.

Add Tracking to Your Website

After setup, Matomo provides a JavaScript tracking snippet. Add it to the <head> of your website:

<!-- Matomo -->
<script>
  var _paq = window._paq = window._paq || [];
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="https://mymatomo.auto.prod.osaas.io/";
    _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 -->

Replace mymatomo.auto.prod.osaas.io with your actual instance URL and 1 with your site ID.

Usage Example

Query the Matomo Reporting API:

# Get visits for the last 7 days
curl "https://mymatomo.auto.prod.osaas.io/index.php?module=API&method=VisitsSummary.get&idSite=1&period=day&date=last7&format=JSON&token_auth=<your-token>"

Find your API token in Settings → Personal → Security → Auth Token.

Resources