[Bug] Tag Manager debug mode becomes unresponsive on Data Layer tab
What happened?
In Tag Manager debug mode, opening the Data Layer tab and checking the logged information of an mtm.AllElementsClick event freezes the page if Matomo is connected to a larger React SPA.
mtm.clickElement holds a reference to the clicked DOM node. On any React page, React attaches two expando properties to every DOM node:
__reactFiber$<...>__reactProps$<...>
The fiber node links to its parent, children, siblings and back to DOM nodes, and each fiber carries memoizedProps / memoizedState.
So, the clicked DOM node transitively references the entire component tree and all application state.
The resulting data displayed in the Data Layer tab thus can quickly bring browsers to their limits. The same issue happens if mtm.clickElement is shown in other places, e.g. in the Variables tab.
(AI disclosure: initial draft created with Claude Opus 5, proof-read and revised by me. This applies to all sections in this issue. Reproducible example below has been double-checked by me.)
What should happen?
For Data Layer tab debug entries whose value is a DOM node, show a compact descriptor in the debug UI (e.g. tag name, id, classes, truncated outerHTML) rather than serializing.
How can this be reproduced?
- Create a new empty Matomo container with one All Elements Click trigger.
- Publish a new version of the container.
- Serve the attached
index.htmlbelow (created using Claude Opus 5; pulls React 19 from https://esm.sh) over http and open it with?container=<container script URL>, e.g.file:///index.html?container=http://matomo.localhost/js/container_aAESPTYt.js&mtmPreviewMode=aAESPTYt&items=2000. - Start debug mode, click any button on the page.
- Data Layer tab -> select an
mtm.AllElementsClickevent. "Pushed data by this event" contains the serialized React tree.
With the items query parameter, the number of rendered buttons can be controlled. Using a large number, e.g. &items=10000 makes the debug Data Layer tab very slow or unresponsive.
Matomo version
5.13.0
PHP version
8.4.24
Server operating system
Linux Debian
What browsers are you seeing the problem on?
Chrome
Computer operating system
Mac, Ubuntu
Relevant log output
Validations
- Read our Contributing Guidelines.
- Follow our Security Policy.
- Check that there isn't already an issue that reports the same bug to avoid creating duplicates.
- The provided steps to reproduce is a minimal reproducible of the Bug.
Source: matomo-org/matomo