nuxt-modules / partytown

Partytown integration for Nuxt. Run third-party scripts from a web worker.
MIT License
320 stars 8 forks source link

@nuxt/parytown did now work with nuxt 3 for adding gtm, crisp #392

Open Ali-0111 opened 8 months ago

Ali-0111 commented 8 months ago

Hi, I tried to add gtm but the codes did not work: I followed the complete docs:

export default defineNuxtConfig({
  modules: ["@nuxtjs/partytown"],
  partytown: {
    forward: ["dataLayer.push"],
  },

  devtools: { enabled: true },
  app: {
    head: {
      script: [
        {
          hid: "gtm",
          innerHTML: `window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-QE3C9S378L');`,
        },
        {
          src: "https://www.googletagmanager.com/gtag/js?id=G-QE3C9S378L",
          defer: true,
          type: "text/partytown",
        },
      ],
    },
  },
});

2: crisp:

export default defineNuxtConfig({
  modules: ['@nuxtjs/partytown'],
  partytown: {
    forward: ['$crisp', '$crisp.push'],
  },
  app: {
    head: {
      script: [
        // Insert your CRISP Script here e.g.:
        { innerHTML: 'window.$crisp = []; window.CRISP_WEBSITE_ID = "0000"' },
        { src: 'https://client.crisp.chat/l.js', async: true, type: 'text/partytown' },
      ],
    },
  },
})
geminigeek commented 7 months ago

its same for me, not working , i also did exactly as in docs , no stats flowing to analytics