4378 shaares
Specifically: advices on loading third party JS :
third-party script is slowing down your page load, you have several options to improve performance:
- Load the script using the
async
ordefer
attribute to avoid blocking document parsing. - Consider self-hosting the script if the third-party server is slow.
- Consider Resource Hints like
<link rel=preconnect>
or<link rel=dns-prefetch>
to perform a DNS lookup for domains hosting third-party scripts. - "Sandbox" scripts with an
iframe
- lazy-load content after the main page content loads but before a user might otherwise interact with the page