gtm-module icon indicating copy to clipboard operation
gtm-module copied to clipboard

gtm loaded twice

Open alexan opened this issue 3 years ago • 2 comments

I'm experience an error where where the gtm container is added to the dom twice. Once from the ssr and once in the client. This is happening when I use a runtime gtm id:

export default {
  modules: [
    '@nuxtjs/gtm'
  ],

  gtm: {
  },

  publicRuntimeConfig: {
    gtm: {
      id: process.env.GOOGLE_TAG_MANAGER_ID
    }
  },
}

the initialization check inside of https://github.com/nuxt-community/gtm-module/blob/master/lib/plugin.js#L85 only takes the id and not the runtimeId into account. We do not specify an id in the non runtime gtm settings. Is the check in plugin on propose or are you open for merge requests fixing this behaviour?

alexan avatar Apr 05 '22 12:04 alexan

do anyone else have this problem? Am I doing something wrong?

alexan avatar Apr 27 '22 11:04 alexan

The gtm module was updated 2 years ago and doesn't support Nuxt 3. I created a discussion on this topic in case you'd like to comment or follow.

iannngit avatar May 25 '22 07:05 iannngit