Open jimmiejackson opened 1 year ago
I am trying to enable tracking for all of my pages except for one. From what I can tell in the documentation, this library automatically tracks page changes and there is no option to exclude a route, so I am needing to only manually send page views.
plugins/gtag.client.ts
import VueGtag from 'vue-gtag-next'; export default defineNuxtPlugin((nuxtApp) => { const config = useRuntimeConfig(); nuxtApp.vueApp.use(VueGtag, { property: { id: config.public.googleAnalyticsId, }, }); });
pages/index.vue
<script lang='ts' setup> import { useGtag } from 'vue-gtag-next'; const $route = useRoute(); const { pageview } = useGtag(); pageview({ page_title: 'Home', page_path: $route.fullPath, page_location: $route.name as string, }); </script>
package.json
{ "devDependencies": { ... "nuxt": "3.4.1", "typescript": "^5.0.4", "vue-tsc": "^1.6.5" }, "dependencies": { ... "nitro": "^2.2.28", "vue-gtag-next": "^1.14.0", } }
On route change, I can see the automatically tracked page plus the one I am manually sending. Am I doing something incorrect, or is this a bug?
Have you disabled pageviews in ga4 yet?
I am trying to enable tracking for all of my pages except for one. From what I can tell in the documentation, this library automatically tracks page changes and there is no option to exclude a route, so I am needing to only manually send page views.
plugins/gtag.client.ts
pages/index.vue
package.json
On route change, I can see the automatically tracked page plus the one I am manually sending. Am I doing something incorrect, or is this a bug?