koko-analytics icon indicating copy to clipboard operation
koko-analytics copied to clipboard

Replace `script.js` with inline JavaScript?

Open rghedin opened this issue 1 year ago • 2 comments

Hi! I notice that script.js that's loaded by Koko Analytics is really small, which made me wonder if it would be possible to load it inline for better performance. Does this thinking even make sense?

rghedin avatar Dec 06 '23 18:12 rghedin

Absolutely. It’s hard to say whether it will be faster because it really depends. On the one hand, the external file is usually cached for quite long so it’s a single download. Having it in the HTML would add the size to each and every page but benefit from slightly better compression rates. However, in WordPress it is quite common for HTML pages to not be cached (eg for comments or e-commerce to work properly). Also with HTTP2 the penalty for additional HTTP requests is substantially lower than what it used to be.I think the current default is probably the same approach but we might make it configurable at some point in time.Op 6 dec. 2023 om 19:03 heeft Rodrigo Ghedin @.***> het volgende geschreven: Hi! I notice that script.js that's loaded by Koko Analytics is really small, which made me wonder if it would be possible to load it inline for better performance. Does this thinking even make sense?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

dannyvankooten avatar Dec 06 '23 21:12 dannyvankooten

That would be awesome, @dannyvankooten!

rghedin avatar Dec 07 '23 10:12 rghedin