Matomo Analytics: Privacy and Consent
Matomo Analytics for Sylius - what cookieless tracking, Do-Not-Track and Klaro gating do technically, which Klaro service is created and how consent is passed on to Matomo
Matomo Analytics: Privacy and Consent
This documentation always describes the latest published version.
This page describes what the plugin does technically. It is not legal advice: whether your tracking requires consent depends on your Matomo configuration and your jurisdiction.
Cookieless tracking
If Cookieless tracking is on (default), the plugin emits disableCookies in the tracking script. Matomo then sets no cookies in the visitor's browser.
Do-Not-Track
If Respect the browser's Do-Not-Track setting is on (default), the plugin emits setDoNotTrack. Visitors whose browser reports Do-Not-Track are then not recorded.
Consent with Klaro
Without Klaro gating, the tracking script loads immediately on every page and records right away. With Klaro gating, the plugin waits for the visitor's consent.
Prerequisite
The option Gate the tracking script behind Klaro consent can only be selected if the Klaro plugin (mmd/sylius-klaro-consent-plugin) is installed and registered as the bundle MmdSyliusKlaroConsentPlugin. Otherwise it is greyed out. The reason: without Klaro the script would be rendered blocked and nothing would ever unblock it, so tracking would be permanently dead.
What happens on save
If you save an entry with Klaro gating on, the plugin creates a service in the Klaro catalog under the Klaro service name (default matomo). This happens on create and on edit, but only if the service does not exist yet. An existing service with that name is never overwritten, so you can adjust it in the Klaro admin.
The created service has these properties:
| Property | Value |
|---|---|
| Purpose | Analytics |
| Required service | no |
| Preselected | no |
| Enabled | yes |
| Run only once | yes |
| Position | 10 |
| Cookie patterns for deletion on decline | _pk_id, _pk_ses, _pk_ref (path /) |
| Title | Matomo Analytics |
| Description | German for German locales, English for all others |
The service is created without a channel restriction. In the Klaro plugin that means it is offered in all channels, not just the channel you are saving. Whether Matomo actually runs in a channel is still decided by that channel's entry. If you want to restrict the service to specific channels, set that in the Klaro admin. The Klaro plugin passes the cookie patterns on to Klaro as deletion rules.
What happens in the storefront
With Klaro gating, the plugin does not emit the tracking script as a normal <script> but as <script type="text/plain" data-type="text/javascript" data-name="matomo">. The value of data-name is your Klaro service name. Klaro recognises this pattern and only unlocks the script once the visitor accepts the service. In addition, the plugin emits requireConsent so that Matomo itself sends nothing as long as no consent exists.
Klaro unlocking the script is not enough for Matomo on its own: Matomo's own consent switch is independent of it. That is why the plugin renders a small bridge once per page that passes Klaro's state on to Matomo:
- On page load it adopts a decision the visitor has already confirmed.
- After that it observes every saved decision through Klaro's
watchinterface, because Klaro triggers no DOM event for this. - On consent it calls
setConsentGiven, on withdrawalforgetConsentGiven.
If window.klaro is not present when the page loads, the bridge writes a warning to the browser console and does nothing else. Nothing is tracked then.
After enabling, check that the service Matomo Analytics appears in the Klaro dialog. Without a visible service no visitor can consent, and nothing is tracked.
What the plugin does not do
- It sets no cookies other than those Matomo sets itself, and renders no opt-out widget of its own.
- It does not process or anonymise IP addresses. That happens in your Matomo instance.
- It does not check whether your Klaro dialog is worded correctly from a legal standpoint.