If you are reporting a bug, please fill in below. Otherwise feel free to remove this template entirely.
Description
What are you reporting?
Boostrap later doesnt work
In main.js
import Vue from "./vue";
import store from "./FormStore.js";
import VueRouter from "vue-router";
import VueGtag from "vue-gtag";
Vue.use(VueGtag, {
config: { id: "UA-xxxxxxxx-y" },
router,
bootstrap: false
});
In app.vue
import { setOptions, bootstrap } from 'vue-gtag';
mounted() {
bootstrap(gtag).then(() => {
console.log("Gtag Actif ? ", gtag);
});
}
get htis message in console
Vue warn]: Error in mounted hook: "ReferenceError: gtag is not defined"
found in
---> at src\components\App.vue
Expected behavior
Gtag should be defined
Tell us what you think should happen.
Actual behavior
Vue warn]: Error in mounted hook: "ReferenceError: gtag is not defined"
Tell us what actually happens.
Environment
Vue 2.0, windows 10 64 bits, Chrome browser ( idem with Mozilla)
Run this command in the project folder and fill in their results:
npm ls vue-gtag
:
`-- [email protected]
Then, specify:
- Operating system:
windows 10 64 bits,
- Browser and version:
Chrome browser ( idem with Mozilla)
Reproducible Demo
I folowed documentation :
import { bootstrap } from 'vue-gtag'
export default {
name: 'MyComponent',
methods: {
enablePlugin () {
bootstrap(gtag).then(() => {
// all done!
})
}
}
}
the bootstrap method will return a promise that will be resolved when the script has been loaded completely.
Please take the time to create a new app that reproduces the issue or at least some code example
In main.js
import Vue from "./vue";
import store from "./FormStore.js";
import VueRouter from "vue-router";
import VueGtag from "vue-gtag";
Vue.use(VueGtag, {
config: { id: "UA-xxxxxxxx-y" },
router,
bootstrap: false
});
In app.vue
import { setOptions, bootstrap } from 'vue-gtag';
mounted() {
bootstrap(gtag).then(() => {
console.log("Gtag Actif ? ", gtag);
});
}
Demonstrable issues gets fixed faster.
Thank You in advance for your help