How to load Google Analytics script
By default nothing is needed: the plugin does everything for you!
However, in some cases, you might want to avoid auto-loading the analytics.js script because:
- maybe the framework you’re using already does it for you
- you really can’t remove it from your project
- other issue that I can’t come up with
So for all those cases it is possible to let the plugin detect if an analytics script has been added already in your html
import Vue from 'vue'
import VueAnalytics from 'vue-analytics'
Vue.use(VueAnalytics, {
id: 'UA-XXX-X',
checkDuplicatedScript: true
})
or just disable the script loader
import Vue from 'vue'
import VueAnalytics from 'vue-analytics'
Vue.use(VueAnalytics, {
id: 'UA-XXX-X',
disableScriptLoader: true
})
Important
It is not possible for the plugin to remove the initial trackers, because it needs them to create all methods for the multi-tracking feature.If you can’t remove initial trackers, don’t use this plugin: the outcome could be unpredictable.
当前内容版权归 vue-analytics 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 vue-analytics .