The plugin extends the storefront template base.html.twig in the block base_body_script and outputs the tracking script there. Depending on the configuration it contains:
| Call on the Matomo tracker | Condition |
|---|---|
disableCookies |
Cookieless Tracking on |
setDoNotTrack |
Respect Do-Not-Track on |
requireConsent |
Require Cookie Consent on |
enableHeartBeatTimer |
Enable Heartbeat Timer on (with the configured interval) |
trackPageView |
always |
enableLinkTracking |
Track Outbound Links or Track Downloads on |
The script then sets tracker URL and Site ID and loads matomo.js asynchronously from your Matomo instance. Whether the script appears at all is governed by Configuration and Privacy.
E-Commerce events are generated on the server when the respective storefront page loads and are output as a separate script after the tracking script. They only appear if Enable E-Commerce Tracking and the respective option are on.
| Event | Page | Matomo call | Transmitted data |
|---|---|---|---|
| Product view | Product detail page | setEcommerceView |
Product number, name, category path, price |
| Cart | Cart page and checkout confirmation | addEcommerceItem per product, trackEcommerceCartUpdate |
Product number, label, unit price, quantity, total |
| Order | Order finish page | addEcommerceItem per product, trackEcommerceOrder |
Order number, grand total, net amount, tax amount, shipping costs |
Details:
/. If there is no category, false is passed.At /matomo/opt-out (route frontend.matomo.optout, method GET) the plugin provides a storefront page with title, description, Matomo's opt-out iframe and an info text. Link it in your privacy policy. The texts come from the plugin's snippets.
| Snippet | Text (English) |
|---|---|
mmd-matomo.optOut.title |
Matomo Analytics Opt-Out |
mmd-matomo.optOut.description |
Here you can disable the Matomo web analytics tool for this website. |
mmd-matomo.optOut.info |
We use Matomo to analyze visitor behavior on our website. Your privacy is important to us. |
mmd-matomo.optOut.cookieless |
This website uses privacy-friendly tracking without cookies. No opt-out is required. |
mmd-matomo.optOut.disabled |
Web analytics is disabled on this website. |
If tracking is not configured validly, the page shows the cookieless text (when Cookieless Tracking is on) or disabled instead of the iframe.
You can include the component in your own templates or CMS layouts:
{% sw_include '@MmdMatomoAnalytics/storefront/component/matomo-opt-out.html.twig' %}
{% sw_include '@MmdMatomoAnalytics/storefront/component/matomo-opt-out.html.twig' with {
language: 'en',
backgroundColor: 'f5f5f5',
fontColor: '333333'
} %}
| Variable | Default |
|---|---|
language |
the first two characters of the request locale |
backgroundColor |
ffffff |
fontColor |
000000 |
The component checks the settings without a sales channel, that is, with the values set in the admin without a channel selected.