diff --git a/lib/plugin.js b/lib/plugin.js index dc2bd3b..8b95c48 100644 --- a/lib/plugin.js +++ b/lib/plugin.js @@ -1,8 +1,11 @@ import Vue from 'vue' import VueAnalytics from 'vue-analytics' -export default async function ({ app: { router } }) { +export default (ctx, inject) => { const options = <%= serialize(options) %> - Vue.use(VueAnalytics, {...{ router }, ...options}) + Vue.use(VueAnalytics, {...{ router: ctx.app.router }, ...options}) + + ctx.$ga = Vue.$ga + inject('ga', Vue.$ga) }