google-gtag-module
google-gtag-module copied to clipboard
this.$metaInfo not available in layout.vue
According to this: https://github.com/nuxt-community/google-gtag#to-make-sure-that-every-page-is-tracked-correctly
one can put the mounted() Code inside of the layout.vue file which does not work because the layout file has no this.$metaInfo information accessible.
If i am right the readme should be changed from
// make sure to set disableAutoPageTrack: true inside of nuxt.config.js
// inside of your Page.vue/Layout.vue file
to
// make sure to set disableAutoPageTrack: true inside of nuxt.config.js
// inside of your Page.vue files
BTW: Is there any way to globally import that code as a mixin into all page components only? (Not all components globally)
I'm facing the same issue. For now I will be using the disableAutoPageTrack to false method
To track all pages, I need to put tracking code on every page. Is there any other way?
Bump ^^