There is a first-class Astro integration for partytown.
Astro includes a CLI tool for adding integrations. Using the
astro add command will automatically install Partytown and configure your project.
yarn astro add partytown # or npx astro add partytown
type: 'text/partytown' attribute to any scripts you want to be handled by Partytown.
<script type="text/partytown" src="https://example.com/analytics.js"></script>
Note that the Astro Partytown integration already handles copying the library files to the correct location.