docs: update vue plugin example (#1311)

This commit is contained in:
Mykola Skrypets 2021-10-21 12:58:07 +03:00 committed by GitHub
parent d1214c9aae
commit 1a41c8819b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,23 +51,20 @@ If you want to use Vue plugins, like [vue-gtag](https://github.com/MatteoGabriel
First install the plugin you want.
```bash
yarn add --dev vue-gtag
yarn add --dev vue-gtag-next
```
Then create a plugin file `plugins/vue-gtag.client.js`.
```ts
import { defineNuxtPlugin } from "#app";
import VueGtag from "vue-gtag";
import VueGtag from "vue-gtag-next";
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(VueGtag, {
config: {
id: "GA_MEASUREMENT_ID",
params: {
anonymize_ip: true,
},
},
nuxtApp.vue.use(VueGtag, {
property: {
id: "GA_MEASUREMENT_ID"
}
});
});
```