Matomo event tracking causing UI lag on media-heavy landing pages

Hi everyone,
I’m looking for some advice on optimizing my Matomo configuration to avoid performance bottlenecks. I’ve recently integrated Matomo on a project page dedicated to pc video editing tools, and I’ve noticed a strange correlation between the tracking script and the site’s responsiveness.

Whenever I enable “Heartbeat” timer tracking or high-frequency event listeners, the page becomes noticeably sluggish on mid-range laptops. Specifically, the video previews in my gallery start to stutter during the render process. It seems like the constant piwik.php requests are competing for the main thread, especially when the browser is already busy handling the high-bitrate video assets needed for a desktop-class software preview.

I’ve tried switching to a longer heartbeat interval and even moving the tracking script to a different execution priority, but I’m still seeing “long tasks” in my browser’s performance profile that point back to the Matomo JS. Has anyone else dealt with this when tracking pages that require high CPU/GPU resources for media? I’m also curious if using the Matomo Tag Manager might offer better asynchronous handling than the standard tracking snippet in this specific case. Any tips on keeping the tracking accurate without tanking the user experience would be huge!

Are you sure it is Matomo? For example, disabling tracking and checking the page load speed. The heatbeat should only send a request when

  • switching to another browser tab after the current tab was active for at least 15 seconds (can be configured see below).

  • navigating to another page within the same tab.

  • closing the tab.

Do you have the media analytics plugin installed?