docs_vue2/plugins/hm.js

15 lines
422 B
JavaScript
Raw Normal View History

2020-08-13 11:47:56 +08:00
export default ({ app }) => {
if (process.env.NODE_ENV !== 'production') return
2021-02-02 17:57:29 +08:00
var _hmt = (window._hmt = window._hmt || [])
2020-08-13 11:47:56 +08:00
var hm = document.createElement('script')
2021-02-02 17:57:29 +08:00
hm.src = 'https://hm.baidu.com/hm.js?3b91e2b87603771f136a8c593a515811'
2020-08-13 11:47:56 +08:00
var s = document.getElementsByTagName('script')[0]
s.parentNode.insertBefore(hm, s)
app.router.afterEach(to => {
_hmt.push(['_trackPageview', to.fullPath])
})
}