vue-ga
Google Analytics for Vue.js
Last updated a year ago by rem .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install vue-ga 
SYNC missed versions from official npm registry.

vue-ga

NPM version NPM downloads Build Status donate

Simple Google Analytics binding for Vue.js apps, 534 bytes gzipped.

Install

yarn add vue-ga

Usage

vue-router

// ./router/index.js
import VueRouter from 'vue-router'
import ga from 'vue-ga'

Vue.use(VueRouter)

const router = new VueRouter()
ga(router, 'UA-XXXXX-Y')

export default router

non vue-router

It works with all SPA, even in non-Vue apps, just invoke the collect function after route changes, for example:

ga(collect => {
  // when hash changes
  window.onhashchange = () => {
    collect(location.pathname + location.hash)
  }
}, 'UA-XXXXX-Y')

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

vue-ga © EGOIST, Released under the MIT License.
Authored and maintained by EGOIST with help from contributors (list).

egoistian.com · GitHub @egoist · Twitter @rem_rin_rin

Current Tags

  • 1.1.0                                ...           latest (a year ago)

2 Versions

  • 1.1.0                                ...           a year ago
  • 1.0.0                                ...           4 years ago
Maintainers (2)
Downloads
Today 7
This Week 63
This Month 204
Last Day 0
Last Week 58
Last Month 210
Dependencies (0)
None
Dev Dependencies (7)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |