nice find @Teun , will have to test this script out!
I wasn’t sure if @icheshire’s website was hosted on CMS Hub, which has limited options unless you want to create a custom module or API like you suggested.
Our theme has a custom forms module with an option to defer if it is out of viewport, but it uses a different method.