Cache matomo.js (or piwik.js)
We recommend enabling GZIP as it reduces the size the user needs to load when the matomo.js file is requested. For the standard Matomo tracker, this will reduce the size from about 60KB to 20KB.
<link rel="dns-prefetch" href="//example.innocraft.cloud">
If you are using Matomo for WordPress (and not Matomo On-Premise or Matomo Cloud), then this step is not needed because Matomo would be loaded from the same domain as your website.
To boost the loading of the Matomo tracking file, you can add the following HTML into the header of your website:
<link rel="preload" href="https://yourpiwikdomain.com/matomo.js" onload="embedTracker()" type="script" crossorigin>
<head> of your website, this should not be needed.
If you are using our Matomo for WordPress plugin you can follow this FAQ to locate the path to your JS tracker file.
More performance improvements
Read our first blog in the series at Different ways of embedding the Matomo tracking code for faster website performance