3rd party scripts can be extremely beneficial for your website, making it more interactive and dynamic for visitors. However, they can come with a downside and installing too many or using resource intensive scripts can cause performance issues. It could also be the reason why your website is slow at loading its content. Below we explain more about how 3rd party scripts can impact your website loading speed and what you can do about it.
How do you find a 3rd party script on a webpage?
If you did not set-up the 3rd party scripts on your webpage you may not be aware of their source and location. You can use a free speed test tool such as Chrome DevTools or PageSpeed Insights, which will reveal diagnostic information about your site and list how many third party scripts are loaded, and which ones take the longest to load. When you spot a script that is causing an issue, find out what it is supposed to be doing and consider whether or not it is still needed.
Using Chrome DevTools you can get more information about the third-parties on a page, so you have more insight about their purpose and where they are coming from.
Hit CMD + Shift + P to show the Command Menu. Use “Show third party badges” and when you record a page load it will display the badges of the third party. Hover above the badge and you will see more information about the script.
How can I measure the impact of a third-party script?
Chrome DevTools gives you the option to see the behaviour of a page when an individual stylesheet or script isn’t in use. You can do this using the network request blocking feature, which measures the impact of blocking a specific resource.
To do this, in the Network panel right click and choose “Block Request URL”. You can manage any requests you have blocked with the Request blocking tab in the DevTools drawer.
How can third-party scripts be loaded efficiently?
If you noticed that third-party scrips are slowing down your loading speed, there are few things you can do to improve performance:
Use async or defer attribute to load the script
- Async: The script is downloaded asynchronously by the browser, while also parsing the HTML document. Once the downloading has finished, parsing is blocked during script execution.
- Defer: The script is downloaded asynchronously by the browser, while also parsing the HTML document. Only once the parsing is complete will the script run.
Self-host the script instead
Self-hosting third party scripts gives you more control over things like improving HTTP caching headers, introducing HTTP/2 server push or reducing DNS. If a script is critical to the page, then self-hosting should be given serious consideration.
Be aware that if you do self-host scripts they can go out of date and will need to be manually updated to avoid them becoming inactive or compromised. Automatic updates will not be available due to an API change, which could impact your website. For example, if an API change occurs on an advert it will not run and revenue could be lost.
Removing the script
You could use A/B testing to analyse user experience and behaviour to assess whether or not the script offers enough value for your site. A/B testing tests two versions of a page to show which one offers the best conversion rates. It’s a good idea to run A/B testing scripts to a small section of your user base, which will enable you to split-test while also improving the loading speed for everyone else.
How do I make the changes I need to improve loading speed?
The reason your website may not be loading quickly could be due to 3rd party scripts, or it could be down to a number of different factors. If you are not sure where to start, it is a good idea to carry out a website audit that will highlight any areas of improvement that can be made. It’s something we’ve done for businesses working in a variety of industries, helping to boost user engagement and conversion rates as a result.