Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

74
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda