Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

71
Vistas
How to integrate Google Analytics into your Nuxt.js App

I have made nuxt.js app and I want to integrate Google Analytics. I have found @nuxtjs/google-analytics package, installed it and did everything like it was in documentation, but it still doesn't work.

Here is nuxt.config.js

module.exports = {
...
modules: [
    // Doc: https://axios.nuxtjs.org/usage
    '@nuxtjs/axios',
    '@nuxtjs/pwa',
    // 'nuxt-basic-auth-module',
    '@nuxtjs/google-analytics',
    '@nuxtjs/recaptcha'
  ],
  googleAnalytics: {
    id: process.env.GA_ID || ''
  },
}

When page is loading in browser networking I can see analytics.js, but on the analytics.google.com page I can see nothing, even there is no online users.

Also, I tried to add event on button click, and here is function:

async showLogin() {
  this.$ga.event({
    eventCategory: 'login',
    eventAction: 'login',
    eventLabel: 'login',
    eventValue: 1
  });
  await this.$router.push(`/${this.$store.state.locale}/login`)
},

This is what happens, when user clicks login button, and, as I said, there is no info on analytics.google.com page and there is no info in browser networking.

So, what do I do wrong? If someone have already worked with Nuxt and Google Analytics, how did you integrate it into your app? I didn't find a lot of information on the Internet on this issue, but I tried everything I found, and it doesn't work.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

nuxt.config.js

const testingAnalytics = false

module.exports = {
  buildModules: [
    '@nuxtjs/google-analytics'
  ],
  googleAnalytics: {
    id: '', 
    /* 
      If testingAnalytics  === true than send test hits

      If testingAnalytics  === false than enable analytics
      only when process.env.NODE_ENV === 'production'
    */
    dev: testingAnalytics ? true : process.env.NODE_ENV !== 'production',
    debug: testingAnalytics
      ? {
        enabled: true,
        sendHitTask: true
      }
      : {}
  }
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda