// 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: 'consumo-cuidado',
      pageTracker: {
        router,
        useScreenview: true,
      },
    })
  }
})