Hi,

Great stuff. Especially since it's a free version. Perhaps someone would be interested that there is already a plugin which does the same thing, but it's commercial called Gonzales.
https://tomasz-dobrzynski.com/wordpress-gonzales it has advanced features like loading the scripts only on selected pages and so on.