導入數據分析 Vue gtag

安裝vue-gtag-next

1
npm i -D vue-gtag-next

在main.ts內導入

1
2
3
4
5
6
7
8
9
10
11
12
//引入
import VueGtag from 'vue-gtag-next'

const app = createApp(App)
//使用
app.use(VueGtag, {
property: {
//id: 你的 google 分析追蹤碼
id: import.meta.env.VITE_API_URL,
},
})
app.mount('#app')