Open DmytroIvantsov opened 6 months ago
Thats a very good request. I didnt found a way to do it with this plugin. So I switched to the under the hood vue plugin vue-gtm.
import { type VueGtmUseOptions, createGtm } from '@gtm-support/vue-gtm'
The createGtm you can call to initialise the instance
Would be awesome when the author can put here his aproach when its possible with this library
I solved this issue in the following way:
set enabled: false by default:
gtm: { ... enabled: false, ... }
manually make it active when needed:
config.public.gtm.enabled = true;
gtm.enable(true);
Nice! And what is gtm in ?
gtm.enable(true);
config.public.gtm.enable(true) ?
const gtm = useGtm();
this is a variable provided by the @zadigetvoltaire/nuxt-gtm module
nuxt-config.ts
modules: [
...
"@zadigetvoltaire/nuxt-gtm",
...
]
Can I manually init GTM? For example, init GTM if the user has allowed this in the cookie settings