Matomo Tag Manager - Only preview works


I have a Matomo setup where I currently track all the page visits. Now I want to add events via Matomo Tag Manager.

I would like to load the Matomo Tag Manager and the Matomo JS client with one request by setting “Bundle Tracker” in variables to true. This doesn’t work. I checked the http response and there is only the JS for the tag manager. If I activate the preview mode, everything works as expected. I can see the Matomo JS client in the Matomo Tag Manager preview download and the event is also shown in the visitor log.

Any ideas why the Matomo JS client is not added to the Matomo Tag Manager http response even though “Bundle Tracker” is set to true? I double checked a lot of things (publishing and so on).

Cheers and thanks for any help!

Maybe the preview is previewing the draft version of your MTM…
Did you publish your last version of MTM?

The system integrity test showed that I should delete two files (package-lock.json and something like piwik-delete.php). After doing that, the event works now.

Do you use a single server for Matomo, or several?
We encountered an issue in the past, when using 2 Matomo servers: each server published the JS container on its own folder, so the version on each server was different, depending the one used to generate the JS container.
There is some configuration to do in such case to fix the problem…

I use one Matomo server. What is the benefit of using multiple? For staging and live?

For high traffic, it can be a solution to have several servers… But in such case, the configuration must be updated in order to not have side inconsistency…
So finally you have found a solution, haven’t you?

I hope so. Fighting against a lot weird problems. What helped so far:

  • Make sure that you use browser which allows tracking (eg. FF set per default “Do not track”, …)
  • Check System Integrity and fix everything mentioned there
  • It’s great to have a local play ground (I have a docker-compose file with Matomo inside)
  • Investigate the global JS variables Matomo and MatomoTagManager.
  • Check if you have some caching in front of Matomo server / tracked server and if that could make some problems

Yes, and it seems it is impossible to disable this on firefox.
There is a configuration in Matomo to disable that (Cogs>Privacy>Users opt-out>Support Do Not Track preference)

1 Like