Title: Add setting for &#8220;Preload resource&#8221;
Last modified: March 6, 2026

---

# Add setting for “Preload resource”

 *  [GermanKiwi](https://wordpress.org/support/users/germankiwi/)
 * (@germankiwi)
 * [1 month, 2 weeks ago](https://wordpress.org/support/topic/add-setting-for-preload-resource/)
 * This [Matomo article](https://matomo.org/blog/2017/04/important-performance-optimizations-load-piwik-javascript-tracker-faster/)
   recommends adding both of these for better performance:
 *     ```wp-block-code
       <link rel="dns-prefetch" href="//example.innocraft.cloud"><link rel="preload" href="https://yourpiwikdomain.com/matomo.js" onload="embedTracker()" type="script" crossorigin>
       ```
   
 * The Connect Matomo plugin currently has a setting on the Expert Settings tab 
   for adding dns-prefetch, but not one for adding preload.
 * [@dizzyatinnocraft](https://wordpress.org/support/users/dizzyatinnocraft/) could
   you add a setting to the plugin for adding the preload link too?
 * I currently have a PHP script I use to add this, but I’d much prefer to have 
   it available directly in the plugin itself.
 * Incidentally, in the PHP script that I use, I have it looking like this:
 *     ```wp-block-code
       <link rel='preload' href='https://my.site.com/js/index.php' as='script' />
       ```
   
 * I remember testing it a few years ago and – for reasons I now forget – concluding
   that it wasn’t necessary to include “onload=’embedTracker()'” or “crossorigin”
   in the link, and also changing “type=’script'” to “as=’script'”.
 * But now I don’t remember why – it might have been that the preload didn’t work
   anymore, the way it’s written in the Matomo article. I’m hoping you’ll have more
   expert insight into that!
 * Lastly: I think it would also be better if both the dns-prefetch and preload 
   links are added as early as possible, at the top of the HTML. Currently, if I
   turn on the “Enable DNS prefetch” setting on the Expert Settings tab, the link
   gets added further down in the HTML of the page.

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fadd-setting-for-preload-resource%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/wp-piwik/assets/icon-256x256.png?rev=3467966)
 * [Connect Matomo - Analytics Dashboard for WordPress](https://wordpress.org/plugins/wp-piwik/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-piwik/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-piwik/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-piwik/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-piwik/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-piwik/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [GermanKiwi](https://wordpress.org/support/users/germankiwi/)
 * Last activity: [1 month, 2 weeks ago](https://wordpress.org/support/topic/add-setting-for-preload-resource/)
 * Status: not resolved