@diosmosis opened this Issue on March 22nd 2022 Member

Refs https://github.com/matomo-org/matomo/issues/18981

One potential improvement to page load time: currently the getCoreJs/getNonCoreJs controller actions are synchronous, meaning page load is blocked until they finish, and they can't be split apart and loaded in parallel because of inline scripts that assume they have already been loaded.

The Vue migration will slowly move more of the code currently in getCoreJs out to chunks that are loaded in parallel, but it won't remove all of it. So it would still be an improvement to get them to load concurrently, and without blocking rendering of the page.

Loading them asynchronously is not currently possible as Matomo allows and uses inline scripts that are not deferred, and which assume the existence of JavaScript libraries and Matomo classes/functions being available. During development of Matomo 5, however, it will be possible to disallow inline scripts that are not deferred, change existing scripts and make these two requests load asynchronously.

This one is trivial once the Vue migration is done. It's just disallowing inline <script> without defer, and changing any remaining inline <script>s to <script defer>.

Powered by GitHub Issue Mirror