nuxt-community/google-analytics-module

this.$ga.event not firing

sts-ryan-holton opened this issue · 2 comments

Hi, I'm using the latest version of Nuxt JS 2.x and the Google Analytics Module 2.4.0, I've got Analytics set up, and am trying to send some events, for some reason they don't appear to be showing up in my Analytics dashboard, here's my set up...

<script>
export default {
  mounted () {
    this.$ga.event('Conversions: Account Creation', 'Step 1: Loaded', '', '')
  }
}
</script>

This isn't sending any events to Google?

My build modules set up is...

buildModules: [
  ['@nuxtjs/google-analytics', {
    id: process.env.GA_ID
  }]
],

What's wrong here?

Hi @sts-ryan-holton were you able to solve the problem? i am facing the same problem and i have not been able to solve it.

@JaavierR Yeah, seem to have it working well now, I had the syntax wrong, you need this:

this.$ga.event('category', 'action', 'label')

Just a note on where you use it, mounted is a good place, the store is even better, inject your own function and then you can attribute events based on cookies etc which works really well.