🚨 Breaking Changes
initMode
for manual Gtag initialization - by @johannschopplich (f9080)
ℹ️ Migration
In v2.x and earlier, the enabled
option was used to control manual initialization of the Google tag script. This option has been replaced with initMode
in v3.x. To migrate your configuration, set the initMode
option to manual
:
export default defineNuxtConfig({
modules: ['nuxt-gtag'],
gtag: {
- enabled: false,
+ initMode: 'manual',
id: 'GX-XXXXXXXXXX'
}
})
The enabled
option is still available in v3.x, but is now used to disable the Google tag module for the current environment. This is useful if you want to disable the module in development or staging environments:
export default defineNuxtConfig({
modules: ['nuxt-gtag'],
gtag: {
enabled: process.env.NODE_ENV === 'production',
id: 'G-XXXXXXXXXX'
}
})