登录百度统计管理界面之后把安装代码放到入口index.html对应位置。
 <script>
      var _hmt = _hmt || [];
      (function () {
//        百度统计
        var hm = document.createElement('script')
        hm.src = 'https://hm.baidu.com/hm.js?xxxxxx'
        var s = document.getElementsByTagName('script')[0]
        s.parentNode.insertBefore(hm, s)
      })()
    </script>

 

然后路由加入下列代码。
router.beforeEach((to, from, next) => {  
  // 统计代码  
  window._hmt.push(['_trackPageview', to.fullPath]);                                             
  next();                                            
}); 

  

相关文章:

  • 2021-07-14
  • 2022-02-26
  • 2021-08-09
  • 2021-12-18
  • 2021-12-16
  • 2021-10-25
猜你喜欢
  • 2021-07-17
  • 2021-11-01
  • 2022-12-23
  • 2021-06-03
  • 2022-02-14
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案