0.0.2 • Published 5 years ago

vue-tracking v0.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

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'
    }"
/>