Third party scripts slow down your initial page load substantially by blocking the main thread.

Partytown is a tool that allows you to defer third party scripts like Google Analytics, Facebook Pixel, etc off the main thread by using a web worker. For more information about this tool visit the Partytown docs.


You can add Partytown easily by using the following Qwik starter script:

npm run qwik add partytown

The previous command updates your app and sets the correct configuration in vite.config.ts.

It also adds new files inside to your components folder.


import { QwikPartytown } from './components/partytown/partytown';

export default component$(() => {
  return (
        <meta charSet="utf-8" />
        <QwikPartytown forward={['dataLayer.push']} />
      <body lang="en"></body>


To further configure Partytown with more options, please visit the Partytown Documentation

Made with โค๏ธ by