Site Performance: Using Third Party Code on Your Site
2 min read
You can use third-party code across your site to enrich your visitors' experience and add more capabilities. However, third-party code can impact your site's performance and loading time if not optimized.
In this article, learn more about:
Optimizing code on your site
As third-party code can impact your site performance and speed, it's important to optimize it where possible. Optimizing code can lessen its impact on your site, and provide a smoother, faster experience for visitors.
There are a few ways in which you can optimize your code:
- Add the defer attribute to your third-party script. This attribute tells your visitors' browser to not wait for the script, so your site content can load uninterrupted. The third-party embed loads in the background, and runs when the site's DOM is complete.
- Place third-party scripts at the end of the code body. This ensures that your regular site content doesn't get delayed or prevented from rendering.
- Reduce the amount of third-party code on your site where you can. Only use code that is necessary for your business and site needs, and remove any that are no longer required.
Using marketing code on your site
You may use third-party tools such as Facebook Ads and Google Analytics for marketing purposes on your site. This code, though useful, can affect your site's loading time and performance. As an alternative, we recommend using Wix's integrations to embed marketing tools on your site.
As these options are integrated with Wix, they have less of an impact on your site's performance, and you don't need to worry about attributes or script placement. However, as they are third-party code, we still recommend only implementing them where necessary.
Issues with third-party code
Third-party code has not been tested by Wix and we are therefore unable to provide support for it. If you are experiencing issues with your code snippet, you should check that you've copied the code from the provider and pasted it correctly.
If the code is correct and re-entering it doesn't resolve the issue, contact the code provider directly for support in resolving the issue.