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

Using in Nuxt 3 project. page_view works, but event doesn't #516

Open
YosefMets opened this issue Jan 10, 2023 · 2 comments
Open

Using in Nuxt 3 project. page_view works, but event doesn't #516

YosefMets opened this issue Jan 10, 2023 · 2 comments

Comments

@YosefMets
Copy link

Environment *

npm ls vue-gtag: [email protected]

npm ls vue: [email protected]

Description *

import VueGtag from 'vue-gtag'

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(VueGtag, {
    config: {
      id: 'XXX-XXXXXX',
    },
  }, nuxtApp.$router)
})

page_view works. Then I try use event in the setup:

import { event } from 'vue-gtag'

const addToCart = () => {
  event('add_to_cart', {...});
}

Expected behavior

When I'm adding item to cart nothing's happened in the Googlу Analytics. There is also no new request in the "Network". But in window.dataLayer added a new data ['event', 'add_to_cart', {…}, ...]

What am I doing wrong?

@dizao
Copy link

dizao commented Feb 8, 2023

@YosefMets Hey bro, maybe u need to use query instead event.

import { query} from 'vue-gtag'

const addToCart = () => {
query('event','add_to_cart', {...});
}

@howard-tzw
Copy link

howard-tzw commented May 2, 2023

I meet the same problem, nothings happened in the GA Events

Update: Now I no longer have this issue

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