Come usare correttamente JavaScript di terze parti

Speed performance

How to use third party JavaScript correctly

Sometimes, optimizing the code of your website does not mean it will load the pages quickly.

This happens due to third-party scripts, such as trackers, social-media buttons, ads or analytics.

Thanks to third-party scripts you can make your web page more interactive and dynamic, providing a lot of useful functionality; on the other hand, they can cause some issues like:

  • affecting the performance;
  • problems of privacy and/or security;
  • random changes;
  • unpredictable consequences;

More specifically, they can cause:

  • excessive network requests to multiple servers, causing loading issues;
  • unoptimized videos or images that consume a lot of data;
  • not enough resources' server compression;
  • not sufficient HTTP caching.

third party


How can I identify a problematic third-party script?

Everytime you add a third-party script you are supposed to be completely aware of it and its performance impact.

There are some free web speed test tools (Chrome DevTools, PageSpeed Insights, WebPageTest) that can help you to identify the scripts with diagnostic information: you will know how many scripts your website loads and their execution time.

If you find problematic scripts, always try to figure out if you really need them; alternatively, set your code to make them load after your page has completed the primary loading.


Condividi questa Guida.

Ti è piaciuta? Condividila!

Share it!

Web tools per sviluppatori moderni. Provali!

Generatori, builder e validatori per migliorare le tue performance di ottimizzazione SEO e web

Home Back to top of the page