Static GitHub Issues

[1137] Integration of google analytics

prev: TypeError: app.use() requires middleware functions (using nuxt ^1.0.0-alpha.3)
next: How to watch file changes and run script?

Hi

I am using Nuxt 1.0.0_alpha5 version.

I believe I have followed the recommendations to integrate Google Analytics, with the following link : https://github.com/nuxt/docs/blob/master/en/faq/google-analytics.md I put my own UA value in the plugins file.

Here is how I've integrated it in nuxt.config.js :

  build: {
     vendor:
      [
        'axios',
        'lodash.debounce'
      ],
     plugins: [
      new webpack.ProvidePlugin({ '_': 'lodash'}),
      { src: '~plugins/ga.js', ssr: false }
    ]
   },

I meet the following error message after build, what am I doing wrong. Many thanks.

nuxt build

[nuxt] Building...
  nuxt:build App root: /home/matthieu/helping-pong_nuxt +0ms
  nuxt:build Generating /home/matthieu/helping-pong_nuxt/.nuxt files... +2ms
  nuxt:build Generating files... +10ms
  nuxt:build Generating routes... +8ms
  nuxt:build Building files... +54ms
TypeError: arguments[i].apply is not a function
    at Compiler.apply (/home/matthieu/helping-pong_nuxt/node_modules/tapable/lib/Tapable.js:306:16)
    at webpack (/home/matthieu/helping-pong_nuxt/node_modules/webpack/lib/webpack.js:32:19)
    at /home/matthieu/helping-pong_nuxt/node_modules/nuxt/dist/nuxt.js:1157:73
    at Promise.F (/home/matthieu/helping-pong_nuxt/node_modules/core-js/library/modules/_export.js:35:28)
    at Nuxt.webpackRunClient (/home/matthieu/helping-pong_nuxt/node_modules/nuxt/dist/nuxt.js:1155:10)
    at Nuxt._callee2$ (/home/matthieu/helping-pong_nuxt/node_modules/nuxt/dist/nuxt.js:520:37)
    at tryCatch (/home/matthieu/helping-pong_nuxt/node_modules/regenerator-runtime/runtime.js:65:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/home/matthieu/helping-pong_nuxt/node_modules/regenerator-runtime/runtime.js:303:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/home/matthieu/helping-pong_nuxt/node_modules/regenerator-runtime/runtime.js:117:21)
    at step (/home/matthieu/helping-pong_nuxt/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
    at /home/matthieu/helping-pong_nuxt/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14
    at Promise.F (/home/matthieu/helping-pong_nuxt/node_modules/core-js/library/modules/_export.js:35:28)
    at Nuxt.<anonymous> (/home/matthieu/helping-pong_nuxt/node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12)
    at Nuxt.buildFiles (/home/matthieu/helping-pong_nuxt/node_modules/nuxt/dist/nuxt.js:538:18)
    at Nuxt._callee$ (/home/matthieu/helping-pong_nuxt/node_modules/nuxt/dist/nuxt.js:929:31)
    at tryCatch (/home/matthieu/helping-pong_nuxt/node_modules/regenerator-runtime/runtime.js:65:40)

npm ERR! Linux 2.6.32-042stab120.18
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "build"
npm ERR! node v6.11.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! helping-pong_server@0.0.1 build: `nuxt build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the helping-pong_server@0.0.1 build script 'nuxt build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the helping-pong_server package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     nuxt build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs helping-pong_server
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls helping-pong_server
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/matthieu/helping-pong_nuxt/npm-debug.log
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c999">#c999</a>)</em></sub></div>