0.0.1 • Published 4 years ago

@heisea/monitor v0.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

monitor

前端统一埋点方案,支持pc和h5,兼容vue项目与其他

使用说明

npm i -S @heisea/monitor

第二步:初始化埋点

import monitor from '@heisea/monitor'
monitor.install(monitorParams, options)
  • 参数说明
参数说明类型默认值可选值
monitorParams埋点初始化参数Objectdata_type、action、...ip、 ...

Vue组件click自动埋点上报

1、配置options

  import scout from '@heisea/monitor'

  scout.install(monitorParams, { // 只想用默认值monitorParams可传 {}
    monitorType: 'directive',
    vue: Vue
  })
  // 设置 params 针对 SPA
  scout.setParams({
    user_id: 'xxx'
  })

2、指令

import monitor from '@heisea/monitor'
const monitorParams = {} // 全局配置
monitor.install(monitorParams, {
  monitorType: 'directive',
  vue: Vue
})
点击指令埋点
<!-- vue 指令-->
<!-- 点击事件 -->
<a href="" v-monitor="{data_type: 'event',action:'click' use_id: 'f4h89f45j894f4508j'}">
曝光埋点
<!-- vue 指令-->
<!-- 曝光事件 -->
<a href="" v-exposure="{data_type: 'event',action:'click', userid: 'f4h89f45j894f4508j'}">

点击click埋点

import monitor from '@heisea/monitor';
monitor.click(data, callback)
参数说明类型默认值可选值
data埋点数据Object--
callback埋点回调Function--