Hi,
I recently set up a site with Matomo.
The install guide said to put the tracking code snippet into the section of my site.
As I understand it, this would cause the browser to have to wait for the Matomo script to load before rendering the rest of the page.
As I understand it, putting it in the bottom of the tag instead, would ensure that matomo script is run as the last thing on the page. Before the actual page contents have been loaded/rendered.
So my questions are:
1: Am I right in my understanding that putting the code snippet in would cause my page to wait for matomo script to be loaded and run before continuing? Potentially causing a slow down of my overall page responsiveness (for example, if matomo is slow to respond for some reason)?
2: can I put the matomo code snipped in the bottom of my tag instead of in the section? Or would some stuff break due to this?
3: Are there other means of ensuring a quick page load?
No, the Matomo snippet defers the script download and execution (thanks to 'g.async=true;). In consequence, Matomo does not slow down the page responsiveness. It doesn’t matter if you put the code at the top or the bottom, but top is better to be able to register configuration before any other tracking event occurs…
Thanks for clarifying this. This is indeed good news.
Does this also mean that it is not super critical that Matomo runs on a beefy server. Meaning that if the Matomo server for some reason is over-worked and slow to respond, it will not really affect the user experience, nor the PageSpeed score, etc?
The user experience should not be affected by the Matomo server performance as, even after initialization, all HTTP (tracking) requests are sent asynchronously.
But don’t underestimate the server performance, as further, you’ll need sufficient power for data analytics…