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

Support for Nuxt 3 #152

Open
thoth3x opened this issue May 11, 2022 · 14 comments
Open

Support for Nuxt 3 #152

thoth3x opened this issue May 11, 2022 · 14 comments

Comments

@thoth3x
Copy link

thoth3x commented May 11, 2022

Hi,

It seems this plugin doesn't work on Nuxt 3 (v3.0.0-rc.1)

When I run npm run dev it says Cannot start nuxt: Invalid Version: null

Screenshot 2022-05-11 at 15 57 27

My nuxt.config.ts:

Screenshot 2022-05-11 at 15 58 42

Is there any workaround for that or do you planning on updating the plugin to work with Nuxt 3?

Thanks!

@copostic
Copy link

Would be very appreciated indeed. Any alternative until the release of a compatible version ?

@acidjazz
Copy link

acidjazz commented Feb 5, 2023

@copostic

import { createGtm } from '@gtm-support/vue-gtm'

export default defineNuxtPlugin((nuxtApp) => {
  if (useRuntimeConfig().public.appEnv !== 'production') return
  nuxtApp.vueApp.use(createGtm({
    id: 'GTM-???????',
    defer: false,
    compatibility: false,
    enabled: true,
    debug: true,
    loadScript: true,
    vueRouter: useRouter(),
    trackOnNextTick: false,
  }))
})

@copostic
Copy link

copostic commented Feb 6, 2023

Amazing, thanks @acidjazz I wasn't expecting anything anymore from this thread but what a great surprise on this monday morning !

Have a nice day 🌞

@acidjazz
Copy link

acidjazz commented Feb 6, 2023

Amazing, thanks @acidjazz I wasn't expecting anything anymore from this thread but what a great surprise on this monday morning !

Have a nice day 🌞

no problem! make sure its client only: /plugins/gtm.client.ts

@anton-reviakin
Copy link

anton-reviakin commented Feb 18, 2023

@copostic

import { createGtm } from '@gtm-support/vue-gtm'

export default defineNuxtPlugin((nuxtApp) => {
  if (useRuntimeConfig().public.appEnv !== 'production') return
  nuxtApp.vueApp.use(createGtm({
    id: 'GTM-???????',
    defer: false,
    compatibility: false,
    enabled: true,
    debug: true,
    loadScript: true,
    vueRouter: useRouter(),
    trackOnNextTick: false,
  }))
})

After install @gtm-support/vue-gtm I see request to https://vk.com/js/api/openapi.js?169 and https://connect.facebook.net/en_US/fbevents.js

@niklasfjeldberg
Copy link

Are anyone working on this?

@acidjazz
Copy link

@iustin-gheorghe
Copy link

@acidjazz nuxt-gtag seems to be a GA4 library for Nuxt, not GTM one.

@acidjazz
Copy link

@acidjazz nuxt-gtag seems to be a GA4 library for Nuxt, not GTM one.

nope, it's GTM. using it now w/ my tag on multiple setups.

@GuillaumeDgr
Copy link

@acidjazz nuxt-gtag seems to be a GA4 library for Nuxt, not GTM one.

nope, it's GTM. using it now w/ my tag on multiple setups.

Hi, could you pls provide an example how you are using GTM and GA4 tags in the same time ?
Many thanks

@memic84
Copy link

memic84 commented Nov 17, 2023

@copostic

import { createGtm } from '@gtm-support/vue-gtm'

export default defineNuxtPlugin((nuxtApp) => {
  if (useRuntimeConfig().public.appEnv !== 'production') return
  nuxtApp.vueApp.use(createGtm({
    id: 'GTM-???????',
    defer: false,
    compatibility: false,
    enabled: true,
    debug: true,
    loadScript: true,
    vueRouter: useRouter(),
    trackOnNextTick: false,
  }))
})

We have been using this implementation, but the vue-gtm seems only to add the script in the body, en not in the head. Data is received, but not everything is working correctly in GTM. Seems that the script needs to be added to the head as well. Anybody else had this before?

@nodeexcel
Copy link

nodeexcel commented Jan 23, 2024

modules: [
'@zadigetvoltaire/nuxt-gtm'
],
gtm: {
id: 'GTM-ID',
enabled: true,
debug: false,
},

it's working fine

@joeczucha
Copy link

@acidjazz nuxt-gtag seems to be a GA4 library for Nuxt, not GTM one.

nope, it's GTM. using it now w/ my tag on multiple setups.

Are you sure it's GTM? Just checking as this suggests otherwise: johannschopplich/nuxt-gtag#13

@NikhilVerma
Copy link

I have made a drop in replacement for this module - https://www.npmjs.com/package/gtm-nuxt3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests