nuxt-community / google-analytics-module

Google Analytics Module for Nuxt 2
https://google-analytics.nuxtjs.org/
MIT License
638 stars 54 forks source link

Duplicating pageviews #107

Closed guiwestrup closed 3 years ago

guiwestrup commented 3 years ago

I'm using in pages the this.$ga.page() on the mounted() function, every page change he's shoot two pageviews: Using this plugin for debug: https://chrome.google.com/webstore/detail/google-analytics-debugger/jnkmfdileelhofjcijamephohjechhna

image

image

sharing-tech commented 3 years ago

I'm having the same problem. Changed to manual because I want to use custom dimensions. Duplicate.

guiwestrup commented 3 years ago

How can i deactivate the automatic tracking?

I already use the manual way, in method mounted():

this.$ga.page({ page: this.$router.currentRoute.path, title: this.seo.title, location: window.location.href })

sharing-tech commented 3 years ago

I uninstalled this module and installed the original vue-analytics, which solved this problem. https://github.com/MatteoGabriele/vue-analytics https://matteogabriele.gitbooks.io/vue-analytics/content/

guiwestrup commented 3 years ago

I uninstalled this module and installed the original vue-analytics, which solved this problem. https://github.com/MatteoGabriele/vue-analytics https://matteogabriele.gitbooks.io/vue-analytics/content/

This fixed

mathieuPaczesny commented 3 years ago

To avoid duplication of routes, you can add the ignoreRoutes attribute to your configuration.

googleAnalytics: { ignoreRoutes: ['route_name', 'path_of_route'] },

this will ignore these routes during the automatic push. It will therefore be necessary to manage it manually for these paths Ex :

this.$ga.page(this.$route.fullPath)