docs: update vue-gtag plugin example (#18528)

This commit is contained in:
Theo Ephraim 2023-01-25 22:48:37 -08:00 committed by GitHub
parent ec977c5877
commit 95f45b3fc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -148,7 +148,7 @@ yarn add --dev vue-gtag-next
Then create a plugin file `plugins/vue-gtag.client.js`.
```ts
import VueGtag from 'vue-gtag-next'
import VueGtag, { trackRouter } from 'vue-gtag-next'
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(VueGtag, {
@ -156,6 +156,7 @@ export default defineNuxtPlugin((nuxtApp) => {
id: 'GA_MEASUREMENT_ID'
}
})
trackRouter(useRouter())
})
```