Vue.js plugin making Google Analytics (RGPD friendly) integration easy!
Install the npm package using CLI
npm install vue-handy-ga
# or
yarn add vue-handy-ga
In your index.js
file :
import Vue from 'vue'
import Vuex from 'vuex'
import VueHandyGa from 'vue-handy-ga'
import App from './App.vue'
Vue.use(Vuex)
Vue.use(VueHandyGa)
const options = {
gaID: 'UA-XXXXXXXX-X'
}
new Vue({
el: '#app',
store: new Vuex.Store(),
vueHandyGaSettings: new VueHandyGa(options),
render: createElement => createElement(App)
})
In your Single File Component :
<template>
<div>
<vue-handy-ga />
</div>
</template>
<script>
export default {}
</script>
In your nuxt.config.js
file :
export default : {
// [...]
modules: [
['vue-handy-ga/nuxt', {
gaID: 'UA-XXXXXXXX-X'
}]
]
// [...]
}
Then you can use it the same way you would in a Vue Single File Component.
Find the official documentation here
MIT
- Vue Plugin Boilerplate: f/vue-plugin-boilerplate/