Easily visualize event hooks in Matomo. Never install in production !
Never install this plugin on a production instance. It is a development tool. Every page exposes internal arguments, appends to a log file, and adds DOM elements to Matomo's UI.
HooksViewer subscribes to every event Matomo dispatches and shows you, in real time, which hooks fire — where they fire, in what order, and with what arguments.
Two outputs run side by side:
<details><summary> block at the exact spot in the DOM where it was
dispatched. Open the summary to see a pretty-printed, multi-line dump
of the hook arguments. Widget XHRs (format=html) also surface their
internal hooks like ViewDataTable.filterViewDataTable,
Visualization.beforeRender, Metrics.isLowerValueBetter, etc.tmp/logs/hooksviewer.log. Every hook from every
request — including JSON API calls, tracker hits, and CLI commands —
is appended with timestamp, request id, and arguments. Watch with
tail -f tmp/logs/hooksviewer.log.The plugin never injects markup into JSON, XML, CSV, image, or tracker responses, so Matomo's API stays valid and the dashboard, widgets, and third-party clients keep working.
The list of subscribed events is discovered automatically by scanning
core/ and plugins/ for Piwik::postEvent('…') call sites the first
time the plugin runs (and whenever a source file is added/removed/edited).
The result is cached in tmp/cache/hooksviewer-catalog.php.
You do not have to update the plugin when Matomo introduces new events — they show up the next time the cache is rebuilt.
This plugin is published on the official Matomo Marketplace.
<details> blocks, or tail -f the log.Built by Openmost. Issues and pull requests welcome at https://github.com/openmost/HooksViewer.
GPL v3 or later.
HooksViewer is a development tool that subscribes to every Matomo event and surfaces them, in real time, while you are browsing the admin or exercising the API.
Inline DOM — On HTML pages and on widget AJAX requests
(format=html), each fired event is rendered as a <details><summary>
block at the exact place in the response stream where it was dispatched.
Open the summary to see a clean, indented dump of the hook arguments.
Log file — tmp/logs/hooksviewer.log receives one line per fired
event from every request, including JSON API calls, tracker hits,
and CLI commands. Each line carries a timestamp, a short request id so
you can correlate concurrent requests, an event index, the hook name,
and a compact view of the args.
tail -f tmp/logs/hooksviewer.log
The plugin does not ship a hand-maintained list. On the first request
after activation it scans core/ and plugins/ for every
Piwik::postEvent('…') call site, resolves same-file constant
references, and persists the result to
tmp/cache/hooksviewer-catalog.php. The cache is invalidated whenever
the source tree changes, so new events introduced by a Matomo upgrade
or by a third-party plugin appear automatically.
Wildcard event names (those containing PHP variables or sprintf
placeholders, e.g. Controller.$module.$action) are skipped because
they cannot be subscribed to as a single static name.
Some Matomo responses cannot tolerate any extra bytes:
module=API (JSON / XML / CSV / TSV / RSS)matomo.php and piwik.php (tracker hits and image responses)For these, HooksViewer does not inject anything into the response.
Use the log file (tmp/logs/hooksviewer.log) to observe their hooks.
For HTML pages and widget AJAX (format=html), output is rendered
inline as <details> elements styled to stay readable on light and
dark themes alike.
This plugin exposes internal arguments (including configuration values and visitor data) and writes a log file on every request. Never install it on a production instance.
It is published on the official Matomo Marketplace, like any other plugin:
The plugin renders internal hook arguments into the page (database configuration, visitor IPs, request parameters, etc.) and writes a log file on every request. Both are useful while debugging and unacceptable in production.
Two places, at the same time:
<details><summary> blocks placed exactly
where the event was dispatched. Works on regular admin pages and on
widget AJAX content (format=html).tmp/logs/hooksviewer.log. This catches
every hook from every request — including JSON API calls, tracker
hits, and CLI commands, where the plugin cannot safely inject
markup. Tail it with tail -f tmp/logs/hooksviewer.log.Matomo caches the merged stylesheet bundle on disk. The plugin clears that cache on activation. If you somehow get out of sync, deactivate the plugin and reactivate it — the next request will rebuild the bundle.
The list of subscribed hooks is not hand-maintained. The plugin
scans core/ and plugins/ for Piwik::postEvent('…') calls and
caches the discovered list under tmp/cache/. The cache is rebuilt
whenever the source tree changes, so new events appear automatically
the next time the cache is invalidated.
No. Inline output is only emitted for HTML responses (regular
pages and widget AJAX with format=html). API JSON, CSV exports,
XML, image responses, and tracker hits are left untouched. Use the
log file to observe hooks fired during those requests.
A few things to check:
Controller.$module.$action)? Those
are skipped because they have no fixed name to subscribe to.tmp/logs/hooksviewer.log — if it's not there either, the code
path was not reached.Yes. While it is activated, every visitor and every admin user sees the inline output and the log file grows. Deactivate it as soon as you are done debugging.
Open an issue or a pull request on https://github.com/openmost/HooksViewer.
As long as I keep using Matomo across projects, which is the foreseeable future. I'm the first user of this plugin — if it breaks on a Matomo upgrade I'll see it before you do.