I noticed that there are no network requests being send when I’m doing things that should trigger events tracking. The console log’s above those calls do get logged.
I tried overriding & logging _paq.push, but that doesn’t seem to work.
The most obvious thing to check is if the matomo.js is loaded. As you probably noticed, the tracking code sets up window._paq as an empty array where every command is then added and once matomo.js has loaded it executes all of them in order.
Also make sure that you have not enabled DoNotTrack in your browser (and set up the tracking code to respect it client-side)
Update: You can add the tracking code through your regular code that you do pull through build looks like Webpack, but there are things you need to keep in mind:
You can only use a local variable that you fill with window._paq initially, but for logic that’s called later on you’ll need to use window._paq. This is probably because the matomo.js script overrides window._paq, making you’re local variable invalid from then on. Logic that’s called later on could be tracking custom events for example.
window._paq is not mangled, so that’s usable.
I don’t want to add it through a script in my html because I can’t easily disable tracking on non production environments. In my regular scripts I have faux environment variables that I can check for this.
Regarding debugging:
The _paq is an object (no longer an array) after matomo.js is loaded, making it useless to check it’s content.
Only reliable thing seems to be to check network traffic. A trackEvent should result in an immediate network call.