- Issue created by @yoerioptr
- Status changed to Needs work
over 1 year ago 12:48pm 18 August 2023 - 🇧🇪Belgium dieterholvoet Brussels
Thanks for the patch! Since it's possible to choose your own script source, you should also
- make
href
dynamic, take the scheme + host of the script instead of hardcoding to plausible.io - only add this if the host is different from the current domain (taken from
\Drupal::request()
)
- make
- Status changed to Closed: won't fix
about 1 month ago 12:20pm 6 March 2025 - 🇧🇪Belgium dieterholvoet Brussels
I had a better look at the documentation and I don't believe that a preconnect link is very useful here.
These two resource hints are helpful for improving page speed when you know you'll download something from a third-party domain soon, but you don't know the exact URL for the resource. Examples include CDNs that distribute JavaScript libraries, images or fonts. Be mindful of constraints, use preconnect only for the most important resources, rely on dns-prefetch for the rest, and always measure the impact in the real-world.
Since the Plausible script is a static file on a static path, we do know the exact URL, and we know it'll be cached by the browser which makes a preconnect not necessary. The preconnect could be useful for the AJAX call the script is making to track the event, but that tracking call really shouldn't be considered a priority.
Sources: