Skip to content

lawnstarter/vue-tracking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published