Third-party scripts and libraries can have a significant impact on pagespeed. They can add a lot of extra HTTP requests, increase the size of the page, and block rendering. There are several steps you can take to reduce the impact of third-party scripts and libraries on pagespeed:
- Analyse third-party scripts and libraries: Start by analysing which third-party scripts and libraries are being used on your website. Use browser developer tools or web performance analysis tools like GTmetrix or WebPageTest to identify which scripts and libraries are causing performance issues. (See: 8 Awesome Pagespeed Testing Tools)
- Evaluate the necessity of each script or library: After identifying which scripts and libraries are causing issues, evaluate the necessity of each one. Ask yourself if each script or library is essential to the functionality of your website. If the script or library is not necessary, you should remove it.
- Optimise your third-party scripts and libraries: If the scripts and libraries are essential, try to optimise them. Many libraries offer minified versions that can reduce the size of the files. You could also combine multiple scripts into one file which can reduce the number of HTTP requests.
- Load scripts asynchronously: Load your third-party scripts asynchronously so that they don’t block rendering. You can use the async or defer attributes to accomplish this.
- Use a content delivery network (CDN): Consider using a CDN to host and deliver third-party scripts and libraries. CDNs can serve scripts from locations closer to the user, reducing latency and improving load times.
- Set expiration dates: Set expiration dates for your third-party scripts and libraries to reduce the number of requests made to the server. If the scripts and libraries don’t change frequently, you can set a longer expiration date to reduce the number of requests.
Using these techniques, you can reduce the impact of third-party scripts and libraries on your website’s performance and improve pagespeed.
There are a number of WordPress plugins that can help reduce the impact of third-party scripts and libraries, including:
- WP Asset CleanUp allows you to disable or remove certain scripts and stylesheets from your WordPress site, or you can also load scripts on specific pages only, so they don’t affect the overall performance of your site. The basic version is free, and the pro version starts at £34.99/year.
- Perfmatters helps you disable unnecessary scripts and features on your WordPress site to improve its speed and reduce its impact on server resources. It also provides options to delay loading of certain scripts, allowing your site to load faster. It costs £19.99/year for use on one site.
- Asset Queue Manager allows you to manage the scripts and stylesheets loaded on your WordPress site. You can disable or dequeue unnecessary scripts and stylesheets, as well as prioritise the loading order of certain files. The basic version is free – the pro version starts at $19.99/year.
- Flying Scripts optimises the loading of third-party scripts by delaying their execution until after the page has finished loading. This can significantly improve the initial load time of your website. It costs $19.99/year for use on one site.
- Clearfy offers a range of performance optimisation tools for WordPress, including the ability to disable unused scripts and stylesheets. It also provides options to minify and compress scripts and stylesheets, further improving your site’s speed. The basic version is free, with the pro version starting at $39/year.
These plugins can be used in combination with other performance optimisation techniques to improve your site’s pagespeed and to reduce the impact of third-party scripts and libraries.
There are several Magento 2 extensions that can help reduce the impact of third-party scripts and libraries. Here are a few:
- Lazy Load helps in lazy loading images and iframes to improve page load times. It costs £79.
- Cloudflare provides a range of features that can help reduce the impact of third-party scripts and libraries. It offers both free and paid plans.
Prices may vary depending on the specific features and version of the extension.
In this series:
In this series: