Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

68
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!