#reduce impactThird-party code
3 messages · Page 1 of 1 (latest)
Hi @mystic oyster. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Astro provides a way to reduce the performance impact of third-party code on your website by using an integration called Partytown. Partytown is a lazy-loaded library that helps relocate resource-intensive scripts into a web worker, and off of the main thread. This is particularly useful if you're using third-party scripts for things like analytics or ads, as Partytown ensures that these scripts don't slow down your site. The Astro Partytown integration installs Partytown for you and makes sure it's enabled on all of your pages.
To use Partytown, you don't need any additional configuration. If you have an existing 3rd party script on your site, you can try adding the type="text/partytown" attribute to the script tag:
<script type="text/partytown" src="fancy-analytics.js"></script>
If you open the “Network” tab from your browser’s dev tools, you should see the partytown proxy intercepting this request.