Add Google Tag Manager (GTM) to your nuxt.js application. This plugins automatically sends first page and route change events to GTM.
Note: google tag manager is not enabled in dev mode.
You can set environment variable NODE_ENV
to production
for testing in dev mode.
- Add
@nuxtjs/google-tag-manager
dependency using yarn or npm to your project - Add
@nuxtjs/google-tag-manager
tomodules
section ofnuxt.config.js
modules: [
['@nuxtjs/google-tag-manager', { id: 'GTM-XXXXXXX' }],
]
- Required
Should be in form of
GTM-XXXXXXX
{
layer: 'dataLayer',
env: {
gtm_auth: '...',
gtm_preview: '...',
gtm_cookies_win: '...'
},
scriptURL: '//example.com'
}