I have a site with a third-party Javascript include coming from an external URL. However, it frequently loads very slowly (if at all). It is a tracking service used by our marketing team, so I can't remove it (I have suggested it!).
Currently it's included at the end of my page template with a very simple
<script src='http://remoteurl/'></script>
All the other scripts on the page wait until it has loaded before executing anything, meaning that any JS widgets I'm using don't work until it loads. If it times out, they never run.
So the performance problems of an external site are causing issues on for our site.
The frustrating thing about it is that the site doesn't need this script to load for everything else to function. So is there a way to load it such that it doesn't block the rest of the site's scripts from running if it fails?
(I've tried the defer attribute, but although this affects the execution sequence, it doesn't change the fact that everything has to load before anything happens)
Thanks for any advice.