google-analytics plugin and plugin review
This commit is contained in:
19
plugins/google-analytics.client.ts
Normal file
19
plugins/google-analytics.client.ts
Normal 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,
|
||||
},
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user