zadigetvoltaire / nuxt-gtm

Nuxt 3 module for Google Tag Manager
https://www.npmjs.com/package/@zadigetvoltaire/nuxt-gtm
MIT License
59 stars 3 forks source link

enabled option does not work #26

Open Fukao0129 opened 5 months ago

Fukao0129 commented 5 months ago

The "enabled" option seems not to work.

nuxt.config.ts

  modules: [
   "@zadigetvoltaire/nuxt-gtm"
  ],
  gtm: {
    id: my-id,
    enabled: false
  },

Even with the above settings, tags are still being delivered from Google Tag Manager. Something wrong?

@zadigetvoltaire/nuxt-gtm0.0.13 node 18.18.2 npm 9.8.1 vue 3.3.8 nuxt 3.8.2

gmenunes commented 2 months ago

Had the same issue.

Fukao0129 commented 3 weeks ago

I haven't resolved this issue yet, but I came up with an alternative solution. After adding an environment variable to indicate whether the server is a localhost or not, make the following change.

  modules: [
    process.env.APP_ENV === "local" ? "" : "@zadigetvoltaire/nuxt-gtm",
  ],

This seems to be working well so far. However, this is not a fundamental solution, so I will continue to wait for support.