Skip to content

leifermendez/partytown-qwik

Repository files navigation

Qwik Partytown 🎉

Partytown github fit 2x


Build and Test 🚀 Publish

This is a package that facilitates the implementation of PartyTown in Qwik. If you don't know what Qwik is See

The implementation is easy, just import and enjoy, if you want to make use of a more advanced configuration you can pass the settings as an argument (see possible arguments).

Ohters Integrations

Qwik Integration

Install

npm i @leifermendez/partytown-qwik@latest

If you want view demo code

How use

// vite.config.ts

import { qwikCity } from "@builder.io/qwik-city/vite";
import { qwikVite } from "@builder.io/qwik/optimizer";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";

export default defineConfig(() => {
  return {
    ssr: { target: "webworker", noExternal: true },
    plugins: [qwikCity(), qwikVite(), tsconfigPaths()],
  };
});

Example Google Analytics

import { QwikPartytown } from "@leifermendez/partytown-qwik/adapter";

<QwikPartytown forward={["dataLayer.push"]} />;
<script
  async
  type="text/partytown"
  src="https://www.googletagmanager.com/gtag/js?id=G-NHJQPYGYCB"
/>;

Example Facebook Pixel > Why need a proxy? View explanation

const proxyFb = function (url: any) {
  if (url.hostname === "connect.facebook.net") {
    const proxyMap: any = {
      "connect.facebook.net": "your-proxy-reverse.cloudfront.net",
    };
    url.hostname = proxyMap[url.hostname] || url.hostname;
    return url;
  }
  return url;
};

<QwikPartytown resolveUrl={proxyFb} forward={["dataLayer.push", "fbq"]} />;

More Docs / Community