Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Ali-0111 opened this issue Mar 4, 2024 · 4 comments
Open

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

Ali-0111 opened this issue Mar 4, 2024 · 4 comments
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@Ali-0111
Copy link

Ali-0111 commented Mar 4, 2024

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' },
      ],
    },
  },
})

@maige-app maige-app bot added bug Something isn't working documentation Improvements or additions to documentation labels Mar 4, 2024
@geminigeek
Copy link

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

@Qonflux
Copy link

Qonflux commented Nov 22, 2024

Did you guys find a fix for this issue yet?

@muhsin-life
Copy link

muhsin-life commented Dec 9, 2024

please try below config for gtm

app: {
    head: {
      script: [
        {
          type: "text/partytown",
          innerHTML: `window.dataLayer = window.dataLayer || [];
  window.gtag = function () {
        dataLayer.push(arguments);
    };
  window.gtag('js', new Date());
  window.gtag('config', 'XXXX');
        },
]
}}

@muhsin-life
Copy link

@Ali-0111 Could you please share the exact error message you're seeing in the console? If it happens to be a CORS error, you might need to consider implementing a reverse proxy as a potential solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants