美文网首页
项目埋点(vue)

项目埋点(vue)

作者: jane819 | 来源:发表于2019-08-16 11:05 被阅读0次
  • index.html
 <script>
      var _hmt = _hmt || [];
      (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?bcf4b9aa718c44d0552ca883aed26b42";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
    </script>
* plugins文件-新建track.ts
  import _Vue from 'vue'

type PluginFunction<T> = (Vue: typeof _Vue, options?: T) => void

interface PluginObject<T> {
  install: PluginFunction<T>;
  [key: string]: any;
}

const VueTrack:PluginObject<any> = {
  install: () => {}
}

VueTrack.install = (Vue: typeof _Vue) => {
  function trackEvent(...arg:any) {
    const _hmt = window._hmt || []
    _hmt.push(['_trackEvent', arg]) //百度统计
// 增加实时查看 
// 文档地址:
// http://doc.talkingdata.com/posts/36](http://doc.talkingdata.com/posts/36)
// html - 》head-》引入sdk  <script src="https://jic.talkingdata.com/app/h5/v1?appid=1A39A61C5DAE4FD3BB35D55019381CCC&vn=web&vc=2"></script>
// 设置全局变量TDAPP type->shims-tsx.d.ts
)
    if (arg.length > 2) {
      const kv = { [arg[2]]:arg[3] }
      window.TDAPP.onEvent(arg[1], arg[2], kv)
    } else {
      window.TDAPP.onEvent(arg)
    }
  }
  Vue.prototype.$track = trackEvent
}
export default VueTrack
  • 最后项目直接使用this.$track('事件id',‘参数1’,‘参数2’,‘参数3’)

相关文章

  • 项目埋点(vue)

    index.html 最后项目直接使用this.$track('事件id',‘参数1’,‘参数2’,‘参数3’)

  • vue项目前端埋点

    埋点方案的确定业界的埋点方案主要分为以下三类: 代码埋点:在需要埋点的节点调用接口,携带数据上传。如百度统计等;可...

  • vue神策前端埋点,自定义埋点及追踪用户

    vue项目神策埋点网上的相关资料比较少,只能摸索尝试着调试。全埋点在main.js中引入sensors.init代...

  • Vue 项目声明式主动埋点

    公司系统需求加上埋点功能,用来统计各页面功能的使用情况。于是,结合网上资料以及之前使用埋点系统的经历,仔细研究研究...

  • 项目收集埋点

    我们现在的项目中代码埋点主要就是通过手写代码的方式来埋点,能很精确的在需要埋点的代码处加上埋点的代码,可以很方便地...

  • iOS | 小收获:自动埋点

    用户行为统计,俗称埋点,是一个成熟项目中必不可少的环节。埋点的常规做法是在项目中所有需要埋点的地方插入埋点,但随着...

  • IOS实现无埋点技术

    技术方案实现的背景: 因为在开发项目的时候,埋点都是手动埋的,每次业务需求的改变都要到处埋点,这就免不了会遗漏埋点...

  • 关于项目中埋点的总结和思路

    项目中的埋点怎么做的? 埋点:就是需要统计页面打开或者控件点击次数的方式。借助友盟等平台。分手动埋点、自动埋点两种...

  • 项目埋点的演进

    概念 埋点,是对网页、APP或后台等应用程序进行数据采集的一种行为。通过埋点,可以采集用户在应用中的行为,用于分析...

  • crm项目埋点步骤

    Step1 - 代码部分: 项目:crmadmin (pc) 通用方式(打点一次) 页面引入BaseTrack,添...

网友评论

      本文标题:项目埋点(vue)

      本文链接:https://www.haomeiwen.com/subject/ynlfsctx.html