@nuxtjs/google-analytics

Find more information about @nuxtjs/google-analytics (opens new window)

Installation

First, you need to add the @nuxtjs/google-analytics (opens new window) to your application:

yarn add @nuxtjs/google-analytics

Then, on the nuxt.config.js file, you need to add it to the buildModules key.

{
  buildModules: [
    '@nuxtjs/google-analytics'
  ]
}

To configure it add googleAnalytics section in nuxt.config.js to set the module options:

export default {
  googleAnalytics: {
    id: 'UA-XXX-X'
  }
}

More information about the module options (opens new window)