google-analytics plugin and plugin review

This commit is contained in:
María
2025-08-22 13:02:48 +02:00
parent 500dd1efbe
commit 541e922ff5
7 changed files with 72 additions and 68 deletions

View File

@@ -0,0 +1,19 @@
// TODO: Review if its OK. https://matteo-gabriele.gitbook.io/vue-gtag/migration-v2-to-v3
import { configure } from 'vue-gtag'
import { useRouter } from 'vue-router'
export default defineNuxtPlugin(() => {
const config = useRuntimeConfig()
const router = useRouter()
if (config.public.googleAnalyticsId) {
configure({
tagId: config.public.googleAnalyticsId,
appName: 'latienda.coop',
pageTracker: {
router,
useScreenview: true,
},
})
}
})