PHPackages                             texxasrulez/matomo\_analytics - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. texxasrulez/matomo\_analytics

ActiveRoundcube-plugin

texxasrulez/matomo\_analytics
=============================

Matomo Analytics integration plugin for Roundcube

1.2(8mo ago)13MITPHPPHP &gt;=7.4

Since Aug 19Pushed 7mo agoCompare

[ Source](https://github.com/texxasrulez/matomo_analytics)[ Packagist](https://packagist.org/packages/texxasrulez/matomo_analytics)[ RSS](/packages/texxasrulez-matomo-analytics/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

Roundcube Matomo Analytics
==========================

[](#roundcube-matomo-analytics)

[![Packagist Downloads](https://camo.githubusercontent.com/93c19590884ac2b92629a33c4ff1c106b06fd15668c4907f917c3a4be197f305/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f74657878617372756c657a2f6d61746f6d6f5f616e616c79746963733f7374796c653d706c6173746963266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465266c6162656c3d446f776e6c6f616473266c6162656c436f6c6f723d626c756526636f6c6f723d676f6c64)](https://packagist.org/packages/texxasrulez/matomo_analytics)[![Packagist Version](https://camo.githubusercontent.com/c60fe277c2fef11f39cc96bcebd64dbb26ef56c78f8c94a9fc6e99bd512d4430/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74657878617372756c657a2f6d61746f6d6f5f616e616c79746963733f7374796c653d706c6173746963266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465266c6162656c3d56657273696f6e266c6162656c436f6c6f723d626c756526636f6c6f723d6c696d65677265656e)](https://packagist.org/packages/texxasrulez/matomo_analytics)[![Github License](https://camo.githubusercontent.com/4b9438e033ce254e3e229cf48e788e46747b9ef95d6c02d30dd606aadf11e65d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f74657878617372756c657a2f6d61746f6d6f5f616e616c79746963733f7374796c653d706c6173746963266c6f676f3d676974687562266c6162656c3d4c6963656e7365266c6162656c436f6c6f723d626c756526636f6c6f723d636f72616c)](https://github.com/texxasrulez/matomo_analytics/LICENSE)[![GitHub Stars](https://camo.githubusercontent.com/df72047e2da4e7b45fb1c30b7f066c9d773dfd48f546b3c9f54e1d6111ebad2d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f74657878617372756c657a2f6d61746f6d6f5f616e616c79746963733f7374796c653d706c6173746963266c6f676f3d676974687562266c6162656c3d5374617273266c6162656c436f6c6f723d626c756526636f6c6f723d64656570736b79626c7565)](https://github.com/texxasrulez/matomo_analytics/stargazers)[![GitHub Issues](https://camo.githubusercontent.com/54df87e8e57e2ce89e43ad926a14f0000050f297dc300f1b4f82f6157e72ee9d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f74657878617372756c657a2f6d61746f6d6f5f616e616c79746963733f7374796c653d706c6173746963266c6f676f3d676974687562266c6162656c3d497373756573266c6162656c436f6c6f723d626c756526636f6c6f723d61717561)](https://github.com/texxasrulez/matomo_analytics/issues)[![GitHub Contributors](https://camo.githubusercontent.com/875f39a9cf6c26f226ec2c3456b3c319ad09bafcc7d4908748d7fc6cf4e57751/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f74657878617372756c657a2f6d61746f6d6f5f616e616c79746963733f7374796c653d706c6173746963266c6f676f3d676974687562266c6f676f436f6c6f723d7768697465266c6162656c3d436f6e7472696275746f7273266c6162656c436f6c6f723d626c756526636f6c6f723d6f7263686964)](https://github.com/texxasrulez/matomo_analytics/graphs/contributors)[![GitHub Forks](https://camo.githubusercontent.com/4f26f583a1bb06f0d16531637584625b03670c6ae75b14fe0577141362a9f608/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f74657878617372756c657a2f6d61746f6d6f5f616e616c79746963733f7374796c653d706c6173746963266c6f676f3d676974687562266c6f676f436f6c6f723d7768697465266c6162656c3d466f726b73266c6162656c436f6c6f723d626c756526636f6c6f723d6461726b6f72616e6765)](https://github.com/texxasrulez/matomo_analytics/forks)[![Donate Paypal](https://camo.githubusercontent.com/02124075ee7ea4c192ef867cb30577b0b43ba74ea42b8dbe20b56ef518d94cdb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50617970616c2d4d6f6e65795f506c65617365212d626c75652e7376673f7374796c653d706c6173746963266c6162656c436f6c6f723d626c756526636f6c6f723d666f72657374677265656e266c6f676f3d70617970616c)](https://www.paypal.me/texxasrulez)

This plugin integrates **Matomo Analytics** into Roundcube by injecting the official Matomo tracking snippet on rendered pages.

Why this exists
---------------

[](#why-this-exists)

Older Roundcube plugins targeted **Piwik** (Matomo's former name). This plugin is a clean Matomo-first replacement with simple configuration and privacy-aware defaults.

---

Features
--------

[](#features)

- Injects Matomo tracking script on all Roundcube pages.
- Optional **Do Not Track** (DNT) honoring.
- Optionally **disable tracking for authenticated users**.
- Composer-installable, using `composer/installers`.
- Zero changes required to Roundcube templates.

---

Installation
------------

[](#installation)

### A) Composer (recommended)

[](#a-composer-recommended)

From your Roundcube installation root:

```
composer require texxasrulez/matomo_analytics
```

This will install the plugin into `plugins/matomo_analytics/`.

### B) Manual installation

[](#b-manual-installation)

1. Download the release archive.
2. Extract into your Roundcube `plugins/` directory so it looks like:

```
roundcubemail/
└── plugins/
    └── matomo_analytics/
        ├── matomo_analytics.php
        ├── config.inc.php.dist
        └── composer.json

```

---

Configuration
-------------

[](#configuration)

> **Note on Matomo URL:** You may set `matomo_analytics_url` to a full URL (`https://analytics.example.com/matomo`) **or** a relative path (e.g., `/matomo`). The plugin normalizes relative values to an absolute URL using `window.location.origin`. If you see `.../mail/matomo.js` 404s, your URL was relative without a leading slash (`matomo`); use `/matomo` or the full URL.

Copy the sample config and edit values:

```
cp plugins/matomo_analytics/config.inc.php.dist plugins/matomo_analytics/config.inc.php
```

Open `plugins/matomo_analytics/config.inc.php` and set:

```
// Matomo base URL (no trailing slash)
$config['matomo_analytics_url'] = 'https://analytics.example.com';

// Matomo site ID (integer)
$config['matomo_analytics_site_id'] = 1;

// Respect browser Do Not Track header
$config['matomo_analytics_respect_dnt'] = true;

// Disable tracking for authenticated Roundcube users
$config['matomo_analytics_disable_for_authenticated'] = false;
```

---

Enabling the plugin
-------------------

[](#enabling-the-plugin)

Edit `config/config.inc.php` in your Roundcube installation and add the plugin:

```
$config['plugins'][] = 'matomo_analytics';
```

Clear Roundcube caches if necessary:

```
bin/cleancache.sh
```

---

How it works
------------

[](#how-it-works)

The plugin hooks into Roundcube's `render_page` event and injects the official Matomo loader:

```
var _paq = window._paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);

(function() {
  var u = '/';
  _paq.push(['setTrackerUrl', u+'matomo.php']);
  _paq.push(['setSiteId', '']);
  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);
})();
```

When `respect_dnt` is enabled, the plugin checks the browser's DNT flags and skips injection if enabled. When `disable_for_authenticated` is `true`, no tracking is injected for logged-in users.

---

Debugging
---------

[](#debugging)

Set options in `plugins/matomo_analytics/config.inc.php`:

```
$config['matomo_analytics_debug_enabled'] = true;          // write debug entries to Roundcube logs
$config['matomo_analytics_debug_html_comments'] = true;    // add HTML comment after injection
$config['matomo_analytics_debug_log_channel'] = 'matomo_analytics'; // optional custom log channel
```

View logs at `logs/matomo_analytics` (or your custom channel). Entries are JSON-encoded with event tags like `init`, `render_page:start`, `render_page:skip:*`, `render_page:injected`, `render_page:error`.

### Smoke test

[](#smoke-test)

1. Enable the plugin and set `debug_enabled = true`.
2. Load Roundcube UI and check:
    - **View Source:** find the Matomo snippet, and optionally the `` comment.
    - **logs/matomo\_analytics:** verify entries for injection and config.
3. Toggle `disable_for_authenticated` and `respect_dnt` to verify skip paths.

Debugging &amp; Verification
----------------------------

[](#debugging--verification)

Enable debug in `plugins/matomo_analytics/config.inc.php`:

```
$config['matomo_analytics_debug_enabled'] = true;
$config['matomo_analytics_debug_html_comments'] = true;
$config['matomo_analytics_debug_console'] = true;
```

Open the Roundcube UI:

- **View Source** → Confirm the Matomo snippet and optional ``.
- **Browser Console** → Look for `[matomo_analytics] injecting` info line.
- **Network tab** → Verify `matomo.js` loads **200** and `matomo.php` requests show **200/204** with `idsite=`.
- **Roundcube logs** (`logs/matomo_analytics`) → JSON events for injection/skip/errors.

### Common blockers

[](#common-blockers)

- **Content-Security-Policy** headers must allow `script-src` from your Matomo origin and `img-src` for the beacon.
- **Ad/tracking blockers** can block `matomo.js` or `matomo.php`. Test in a private window with blockers disabled.
- **Mixed Content**: Roundcube must be served over HTTPS if Matomo URL is HTTPS (and vice versa). Avoid protocol mismatches.
- **Wrong Site ID / URL**: Confirm the `Site ID` matches exactly in your Matomo UI and that the URL points to the Matomo root.

### Extras

[](#extras)

- Cross-domain/subdomain tracking: ```
    $config['matomo_analytics_cookie_domain'] = '.example.com';
    $config['matomo_analytics_domains'] = ['*.example.com'];
    ```
- Time-on-page accuracy: ```
    $config['matomo_analytics_enable_heartbeat'] = true;
    ```
- JS-blocked environments: enable `` beacon: ```
    $config['matomo_analytics_fallback_img_beacon'] = true;
    ```

Requirements
------------

[](#requirements)

- PHP &gt;= 7.4
- Roundcube &gt;= 1.4
- A running Matomo server (URL + Site ID)

---

Uninstall
---------

[](#uninstall)

Composer:

```
composer remove texxasrulez/matomo_analytics
```

Manual: delete the `plugins/matomo_analytics/` directory.

---

License
-------

[](#license)

MIT

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance62

Regular maintenance activity

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

265d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/95c3af6e41a9786e8be2edb48176e43a7d1ddef429793a312168450ff4269deb?d=identicon)[texxasrulez](/maintainers/texxasrulez)

---

Top Contributors

[![texxasrulez](https://avatars.githubusercontent.com/u/10519182?v=4)](https://github.com/texxasrulez "texxasrulez (14 commits)")

---

Tags

pluginroundcubematomoanalytics

### Embed Badge

![Health badge](/badges/texxasrulez-matomo-analytics/health.svg)

```
[![Health](https://phpackages.com/badges/texxasrulez-matomo-analytics/health.svg)](https://phpackages.com/packages/texxasrulez-matomo-analytics)
```

###  Alternatives

[composer/installers

A multi-framework Composer library installer

1.4k136.0M6.0k](/packages/composer-installers)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.4k37.3k](/packages/matomo-matomo)[10up/elasticpress

Supercharge WordPress with Elasticsearch.

1.3k374.3k6](/packages/10up-elasticpress)[matomo/matomo-php-tracker

PHP Client for Matomo Analytics Tracking API

2213.1M16](/packages/matomo-matomo-php-tracker)[appsero/client

Appsero Client

25431.7k9](/packages/appsero-client)[offline/oc-mall-plugin

E-commerce solution for October CMS

1744.6k2](/packages/offline-oc-mall-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
