The code expects window.document.body to already exist when it's loaded, which isn't true if the script tag is in . I realize putting the script tag at the bottom of the body is considered best practice, but the library shouldn't just break if you don't do it.
At the very least, there should be some indication that that's what the issue is.