A track point directive for vue.js
- vue: ^2.0.0
From npm:
$ npm install vue-tracker --save
import * as tracker from 'vue-tracker';
tracker.init(fetchFunction)
export default {
template: '<button v-track="{act:'click',data:{id:100}}">Save</button>',
};
import * as tracker from 'vue-tracker';
tracker.init(fetchFunction)
export default {
mixins: [ tracker.mixin ],
template: '<button @click="track(arguments,handleClick)({id:200},true)">Leave</button>/>',
};
// 1. ready: 进入指定页面时触发
// 2. click: 点击指定元素时触发
// 3. view: 指定区域眼球曝光时触发
// 4. unload: 离开指定页面时触发
param = {
t?: Enum {bind|update|unbind}
act: Enum {ready|click|view|unload}
data: {
id: eventId,
p?: [p1?, p2?, ...]
}