# Using Matomo with Joomla

> Track visitors on your Joomla site with Matomo analytics, using the Matomo plugin or by adding the tracking code to your template.

Source: https://helpcenter.ruachost.com/apps/joomla/using-matomo-with-joomla/

**Matomo** (formerly Piwik) is an open‑source web analytics platform that provides detailed insights into your website traffic. On **ruachost.com**, you can integrate Matomo with Joomla to track visitor behavior, measure conversions, and improve site performance.

## Why Use Matomo with Joomla?

- Provides privacy‑friendly analytics compared to Google Analytics.
- Offers detailed reports on visitors, pages, campaigns, and goals.
- Supports GDPR compliance with data ownership.
- Can be self‑hosted or used via Matomo Cloud.

## Methods to Integrate Matomo with Joomla

### Method 1: Using the Matomo Plugin for Joomla

1. Log in to Joomla as an **administrator**.
2. Go to **Extensions → Manage → Install**.
3. Search for **Matomo Analytics Plugin**.
4. Install and enable the plugin.
5. Enter your **Matomo site ID** and **tracking URL** (e.g., `https://analytics.example.com`).
6. Save configuration.
7. Verify tracking by checking Matomo reports.

### Method 2: Adding Tracking Code Manually

1. Log in to Joomla as an administrator.
2. Go to **Extensions → Templates → Templates**.
3. Select your active template.
4. Edit the `index.php` file.
5. Paste the Matomo tracking code before the closing `</body>` tag:

   ```
   <!-- Matomo -->
   <script>
     var _paq = window._paq = window._paq || [];
     _paq.push(['trackPageView']);
     _paq.push(['enableLinkTracking']);
     (function() {
       var u="//analytics.example.com/";
       _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 -->
   ```
6. Save the file.
7. Test by visiting your site and checking Matomo dashboard for activity.

## Important Notes

- Replace `analytics.example.com` with your actual Matomo server or cloud URL.
- Replace `SiteId` with the ID assigned to your Joomla site in Matomo.
- Always back up your template files before editing.
- For advanced tracking (e.g., goals, events, ecommerce), configure settings in Matomo.
