Matomo Analytics
Privacy-friendly Matomo web analytics for Sylius 2 - cookieless tracking, Do-Not-Track, Klaro consent, e-commerce tracking, configurable per channel, dual-mode via storefront and Shop API
Matomo Analytics
This documentation always describes the latest published version.
Overview
Privacy-friendly web analytics with Matomo for Sylius 2 shops. The plugin renders the tracking script in the storefront, records product views and completed orders, and is configured per channel: the Matomo URL, the site ID and every toggle apply to exactly one channel. Tracking works without cookies, honours the browser's Do-Not-Track setting and can optionally be placed behind a Klaro consent.
The plugin is dual-mode: the Twig storefront renders the script, and a headless storefront reads the same channel settings through the Shop API.
Privacy: The plugin sends tracking data only to the Matomo URL you enter per channel, and only over HTTPS. A channel without an entry, with the switch turned off or with incomplete settings tracks nothing.
graph LR
A["Storefront page"] --> C["Tracking configuration of the channel"]
B["Shop API request"] --> C
C --> D{"Enabled and valid?"}
D -->|"No"| E["Nothing rendered / HTTP 404"]
D -->|"Yes"| F["Tracking script via Twig hook"]
D -->|"Yes"| G["JSON with the settings"]
Documentation
| Page | Content |
|---|---|
| Installation and Operation | Installation via Composer, setup command, update, uninstall |
| Configuration | Settings per channel with defaults, admin interface, practical examples |
| Privacy and Consent | Cookieless tracking, Do-Not-Track, Klaro gating in detail |
| Storefront and Tracking | What is tracked, Twig hooks and Twig functions, theme notes |
| Shop API / Headless | Endpoint for the channel settings, response format, errors |
| Extensibility | Replaceable interfaces, events, what is not part of the stable API |
| Troubleshooting and FAQ | Common problems, known limitations, frequently asked questions |
| Technical Details | Flow, plugin structure, database table |
Features
| Feature | Description |
|---|---|
| Cookieless tracking | On by default: visitors are recorded without Matomo cookies |
| Do-Not-Track | On by default: the browser's Do-Not-Track setting is honoured |
| Klaro consent | Optional: the tracking script is only unlocked after consent in the Klaro dialog; the matching Klaro service is created automatically on save |
| E-commerce tracking | Product views (SKU, name, category) and completed orders (line items, revenue, tax, shipping, discount), each switchable on its own |
| Heartbeat and link tracking | Optional: heartbeat timer for time on page, and tracking of outbound links and downloads |
| Per channel | Matomo URL, site ID and all toggles apply to exactly one channel |
| Dual-mode | The storefront renders the script, the Shop API provides the settings for headless storefronts |
| Fault tolerance | If the plugin table is still missing (migration not run), the shop stays available and renders no tracking |
Requirements
| Requirement | Version | Notes |
|---|---|---|
| Sylius | ^2.2 | CI runs the test suite on Sylius 2.2 and 2.3 |
| PHP | ^8.3 | |
| Symfony | ^7.4 | |
| Database | MySQL 8 or MariaDB | Other databases are not supported. The migration is written in MySQL syntax and aborts on other platforms. Tested against MySQL 8.4. |
| Matomo | any instance | Self-hosted or cloud, reachable over HTTPS |
| Klaro plugin | optional | mmd/sylius-klaro-consent-plugin, only needed for Klaro gating |
License
Commercial license: one license covers one Sylius installation, meaning one Sylius deployment with one database and one vendor directory, including all channels. Development and staging environments are included if you use them exclusively for testing the licensed production installation. Each additional production installation needs its own license. Redistribution is not allowed, updates are included for 12 months from purchase.
Support
For licensing questions, technical questions or bugs, reach me at support@markus-michalski.net.