Skip to content

Commit

Permalink
feat(module): inject $ga in ctx (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardogobbosouza authored and pi0 committed Feb 26, 2019
1 parent aed7df7 commit 2c42bf3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/plugin.js
Original file line number Diff line number Diff line change
@@ -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)
}

0 comments on commit 2c42bf3

Please sign in to comment.