Does Grav set click handlers? Matomo (ex-Piwik) does not track downloads on Grav site

Hello everybody,

I have a Grav site that uses Matomo tracking (PHP only, no cookies). Works fine so far, but the PDF downloads do not get tracked at all. According to the Matomo FAQ, the problem might be other click handlers being set on the links. Since I’m not doing that consciously anywhere, it would have to be a built-in Grav thing (or possibly a plugin of course).

I don’t how how to find out whether that might be the case. Does anybody know about that, or how I might find out?

Thank you so much already!

@Netzhexe,

  • Have you tried disabling all plugins?
  • Have you tried a bare template that does not add any assets (except the ones for Matomo)?

And you might try copying the following into the console of the browser. It will list all events attached to all elements:

console.table(
	[document, window].concat([...document.querySelectorAll('*')]).map(el => {
		let evs = getEventListeners(el);
		// evs = (evs.click ? { click: evs.click } : []);
		return {
			el: el,
			types: Object.keys(evs).join(', '),
			listeners: evs
		};
	}).filter(item => item.types)
);

Found it after a little bit of Googling.