Analytics

Google Analytics 4

1、Go to https://analytics.google.com.

2、Set the gtag

Get G-xxx, then in nuxt.config.ts set the gtag.

nuxt.config.ts
    gtag: {        id: 'G-xxxx'    }

3、Use gtag

In *.vue file, use UseGtag() to import

some.vue
<script setup lang="ts">    const {gtag} = useGtag()    gtag('event', 'btn_generate', { action: 'click' });</script>

© Copyright 2024 fast2build