Google Tag Manager

1. Add @nuxtjs/gtm dependency to your project
      yarn add @nuxtjs/gtm # or npm install @nuxtjs/gtm
  
2. Add @nuxtjs/gtm to the modules section of nuxt.config.js
      export default {
  modules: [
    '@nuxtjs/gtm',
  ],
  gtm: {
    id: 'GTM-XXXXXXX'
  }
}
  
3.Define a plugin in plugin/gtm.js and add to the plugin section of nuxt.config.js
      export default {
 modules: [
  '@nuxtjs/gtm'
 ],
 plugins: [
  '~/plugins/gtm'
 ]
}
  
4.copy this into plugin
      export default function({ $gtm, route }) {
  $gtm.init('GTM-XXXXXXX')
}
  
5. Use this plugin like this
      this.$gtm.push({ event: 'myEvent', ...someAttributes })