How to Install the Matomo Module in Drupal?

For websites using Drupal, tracking visitor behavior and performing detailed web analytics is very important. Matomo (formerly Piwik), an open-source and GDPR-compliant web analytics platform, can be integrated with your Drupal site. In this guide, we will cover, step by step, the installation, configuration, and basic usage of the Matomo module on Drupal. That way you can measure your site's performance securely and transparently.

WhatsApp

Why Is Matomo and Drupal Integration Important?

Drupal websites are known for their flexible structure and powerful content management features. When choosing a web analytics solution for these sites, data privacy, customizable reporting, and ease of use should be prioritized. This is where Matomo becomes an ideal choice for Drupal sites.

Matomo keeps user data entirely under your control, providing a GDPR- and KVKK-compliant analytics experience. Unlike Google Analytics 4, with Matomo your data is not stored on third-party servers, ensuring your privacy is protected. Additionally, its seamless integration with Drupal—through modules and plugins—allows you to easily manage your site’s analytics needs.

Using Matomo on Drupal enables you to track visitor behavior in detail, measure conversion rates, and optimize content performance. With flexible dashboards, custom reporting options, and e-commerce integrations, you can effectively enhance your website’s performance.

In short, integrating Matomo with Drupal offers a powerful alternative to Google Analytics 4 for Drupal sites, providing superior data security, manageability, and advanced analytics capabilities.

Prerequisites Before Installing Matomo on Drupal

Before you start using Matomo on your Drupal site, it’s important to be aware of certain preparation steps. These steps may vary for new users and existing users.

For New Users

  • Cloud or On-Premise Choice: If you want to use Matomo quickly and easily, you can opt for the Cloud version. For more control and customization, you should install the On-Premise version.
  • Installation Guides: You can access Matomo’s official Drupal module installation guide [here].

For Existing Users

  • Adding a New Site: To add a new Drupal site to your existing Matomo account, use the relevant options in the admin panel.
  • Administrator Account Requirement: To integrate Matomo with your Drupal site, you need a valid administrator account on your site.

System Requirements

  • PHP 7.4 or higher
  • MySQL 5.7 / MariaDB 10.2 or higher
  • Apache or Nginx web server
  • Matomo module compatible with Drupal 9 or Drupal 10

Once these preparations are complete, you can start the Matomo installation on your Drupal site smoothly.

Installing the Matomo Module on Drupal

To install and activate the Matomo module on your Drupal site, follow these steps. This process is user-friendly and ensures the module works smoothly:

  1. Log in to the Drupal Admin Panel
    Start by logging in with your administrator account to initiate the module installation process.
  2. Go to the Modules Section
    From the admin menu, navigate to Structure > Modules.
  3. Add a New Module
    Click the “Add New Module” button and select the Matomo module file you previously downloaded.
  4. Upload the Module File
    After selecting the file, click “Install”. Drupal will automatically handle the installation.
  5. Activate the Module
    Once installed, locate the Matomo module in the modules list and check the “Enable” option.
  6. Complete the Configuration
    After activation, finalize the integration by entering necessary settings such as Matomo’s API key and site ID.

Configuring the Matomo Tracking Code

Drupal sitenizde Matomo’yu doğru ve etkili şekilde kullanabilmek için yapılandırma adımlarını eksiksiz uygulamak önemlidir. Bu adımlar, site kimliği ve kapsayıcı URL gibi temel bilgilerin girilmesini, izleme kodunun eklenmesini ve verilerin düzenli olarak yönetilmesini kapsar.

  1. Select Matomo from the Drupal Configuration Section
    In the Drupal admin panel, navigate to Configuration > Matomo Analytics to open the module settings.
  2. Fill in the Site ID and Container URL Fields
  • Site ID: Enter the ID of your site as created in the Matomo dashboard.
  • Container URL (Matomo URL): Enter your Matomo server URL correctly so that all data is sent to the right account.
  1. Add the Tracking Code to the Head Tag
    Copy the JavaScript tracking code generated in Matomo and add it to the <head> section of your Drupal site. This ensures that all page visits and user interactions are tracked accurately.
  2. Manage Historical Data
    Over time, as user visits accumulate, the volume of data increases. It is recommended to regularly clean up old data:
  • Recommended Retention: 180 days
  • Setting: In the Matomo dashboard, go to Administration > Privacy > Regularly delete old raw data to enable automatic deletion of old raw data.

Once these steps are complete, your Drupal site will be fully integrated with Matomo, allowing you to track visitor data securely, GDPR-compliantly, and efficiently.

Verifying and Testing Matomo Integration

After successfully integrating Matomo into your Drupal site, testing the integration to ensure it works correctly is a critical step. These actions help confirm that data collection is functioning properly and allow you to detect potential issues early.

  1. Visit a Page with the Tracking Code
    After installation, open a page where the Matomo tracking code has been added and refresh it. This is the first step to test whether the code is working correctly.
  2. Check Real-Time Data in the Matomo Dashboard
    Open the Real-Time Visitors section in the Matomo admin panel.
  • If your page visit appears in the dashboard, the integration is successful.
  • If no data is showing, double-check the Site ID and Container URL settings.
  1. Check for Errors in the Browser Console
    While visiting the page, open your browser’s developer console (F12) to check for JavaScript errors.
    If the Matomo tracking code loads correctly without any errors, the data flow is functioning smoothly.
  2. Perform Sample Test Visits
    Navigate through different pages and perform several test visits, then verify that these visits are recorded in the Matomo dashboard. This ensures that both individual page views and user interactions are being tracked.

Regularly performing these checks ensures that the Matomo integration continues to work smoothly and helps you obtain accurate and reliable data from your website.

Son Güncelleme: 05/11/2025

Our Officess

Dublin

20 Harcourt Street, Dublin 2, D02 H364

+353 (87) 198 6950 

[email protected]

İstanbul

GOSB Teknopark Hi-Tech Bina 3.Kat
B3 Gebze - KOCAELİ

+90 262 678 8872 

[email protected]

Frankfurt

Bleichstr. 26 64283 Darmstadt
Deutschland

+49 (0) 6151 – 492 70 23 

[email protected]