Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GA4 setup for Vue 2 #491

Open
shkipan opened this issue Oct 18, 2022 · 2 comments
Open

GA4 setup for Vue 2 #491

shkipan opened this issue Oct 18, 2022 · 2 comments

Comments

@shkipan
Copy link

shkipan commented Oct 18, 2022

Environment *

npm ls vue-gtag:
└── [email protected]
npm ls vue:
└── [email protected] dedupedThen, specify:

  1. Operating system:
    MacOs Monterey 12.5
  2. Browser and version:
    Google Chrome Version 106.0.5249.119

Description *

Event is not fired into google analytics for Google Analytics GA-4

I have an event, which is set up in vuex store and fired after user login. Code looks like this

    import { event } from 'vue-gtag'

    event("login", {
      'event_category': "user",
      'event_label': user.email,
      'value': 1
    })

And this event works correctly for UA-XXXXXXXXX-X key works perfectly fine. However, when I have migrated to G-XXXXXXXXXX, events have stopped firing. Worth to mention, that page views are registered correctly for both keys.

vue-gtag setup looks like this

import Vue from "vue"
import VueGtag from "vue-gtag"

import router from "@/router"

Vue.use(VueGtag, {
  config: {
    id: "G-**********",
  }
}, router)

I have switched to this library, since it was mentioned, that this lib works with GA-4 keys and supports Vue 2. Could you give me a hint, what should I do to fix this issue?

@SliderCO-007
Copy link

I had to create a whole new property for G4 but once I did the legacy version of the plugin worked fine.

Add a Google Analytics 4 property

For reference, my site was built using Vue 2 and is deployed to Firebase hosting.

@saudsayed
Copy link

Same issue, page views are getting registered correctly, however events are not getting fired

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants