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

Disable AutoTracking not working #526

Open
totomaze opened this issue Feb 10, 2023 · 1 comment
Open

Disable AutoTracking not working #526

totomaze opened this issue Feb 10, 2023 · 1 comment

Comments

@totomaze
Copy link

Please fill in at least the mandatory (*) questions below, or I will immediately close this issue without reading. Thanks

Environment *

Run this command in the project folder and fill in their results:

npm ls vue-gtag:
`-- [email protected]

npm ls vue:
+-- [email protected]

Then, specify:

  1. Operating system:
    windows 10
  2. Browser and version:
    Chromium 109.0.5414.119

Description *

What are you reporting?
Vue.use(VueGtag, {
pageTrackerPrependBase: false,
pageTrackerEnabled: false,
pageTrackerScreenviewEnabled: false,

config: {
    id: process.env.VUE_APP_ANALYTICS_KEY
}

})

I tried to stop sending a page view after a change of route, but nothing works, It send a page view at each route change
I am working with history mode

Expected behavior

Tell us what you think should happen.
I was hoping the nothing will be send on a route change

Actual behavior

Tell us what actually happens.

A query is sent to GA on every route change. I am not sure if I am missing something in the config to stop the auto page tracker

Reproducible Demo in case of a bug report

Please take the time to create a new app that reproduces the issue or at least some code example
Vue.use(VueGtag, {
pageTrackerPrependBase: false,
pageTrackerEnabled: false,
pageTrackerScreenviewEnabled: false,
config: {
id: process.env.VUE_APP_ANALYTICS_KEY
}
})

The router is in history mode

Demonstrable issues gets fixed faster.

@ArthurOnly
Copy link

I faced the same problem today and solved this way:

The problem

I noticed that when i reload my page with

app.use(VueGtag, {
  pageTrackerEnabled: false,
  config: { 
    id: 'xxx',
    params: {
      send_page_view: false,
    },
  },
});

The page view events continued to be sent. I removed the Gtag config from this lib and directly used the default gtag config in my index.html that load the SPA. Even with this, events continued to be sent.

Solution

The solution I found is to change an analytics configuration (datastream) like mentioned here https://support.google.com/tagmanager/thread/51544115/spa-page-view-tracking-sends-event-twice?hl=en. This configuration makes the app send events automatically when history changes. So, the app stops sending events and I manually send with

event('page_view',{
    page_title: `xxxx',
    page_path: to.path,
    page_location: window.location.href,
    page_referrer: from.path,
   ...other params
  })

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

2 participants