vue-tracking

0.0.2 • Public • Published

vue-tracking

npm install vue-tracking

// main.js
 
import Vue from "vue";
import App from "./App.vue";
// import the `initialize` method
import { initialize } from "vue-tracking";
 
Vue.directive(
  "track",
  initialize(
    // drop in any method you want called here
    console.log
  )
);
 
new Vue({
  render: h => h(App)
}).$mount("#app");
// usage examples
 
<a
  href="#"
  v-track.click="{
        target: 'terms-of-service--link',
        anyOtherDataYouWant: 'whatever'
    }"
  >Terms of Service
</a>
 
<input
  v-track.blur="{
        target: 'first-name--input',
        exampleData: 'sure why not'
    }"
  v-track.focus="{
        target: 'first-name--input',
        canPassUpAnything: 'go for it'
    }"
  v-track.change="{
        target: 'first-name--input',
        anyExtraData: 'add it onto the direcetive'
    }"
/>

Readme

Keywords

none

Package Sidebar

Install

npm i vue-tracking

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

3.3 kB

Total Files

4

Last publish

Collaborators

  • lfkwtz
  • lawnstarterteam