spyfu-vue-analytics

Installation
This plugin enables easy logging of events to third party analytics providers.
yarn add spyfu-vue-analytics
npm install spyfu-vue-analytics
Basic usage
Once the package is pulled in, you must instruct Vue to use it.
import Analytics from 'spyfu-vue-analytics';
import Vue from 'vue';
Vue.use(Analytics, {
events: {
userSignup: {
google: {
},
},
},
handlers: {
google(eventName, eventConfig, payload) {
},
},
logPageView(route) {
},
});
Finally, when an event you care about happens, use the $logEvent function to call your handlers.
export default {
methods: {
onUserSignup() {
this.$logEvent('userSignup', payload);
},
},
};