diff --git a/public/index.html b/public/index.html index c073aef..04fdd63 100755 --- a/public/index.html +++ b/public/index.html @@ -18,8 +18,8 @@
- - +
diff --git a/src/router/index.js b/src/router/index.js index d1544e9..181dd87 100755 --- a/src/router/index.js +++ b/src/router/index.js @@ -113,17 +113,19 @@ const router = new VueRouter({ router.beforeEach(async (to, from, next) => { if (to.meta.title) document.title = getPageTitle(to.meta.title); - var _hmt = _hmt || []; - var hm = document.createElement("script"); - hm.src = "//hm.baidu.com/hm.js?4bd66cbe45a640b607fe46c48f658746"; - var s = document.getElementsByTagName("script")[0]; - s.parentNode.insertBefore(hm, s); + if (window._hmt) { + if (to.path) { + window._hmt.push(['_trackPageview', '/#' + to.fullPath]) + } + } - var _hmt1 = _hmt1 || []; - var hm1 = document.createElement("script"); - hm1.src = "//v1.cnzz.com/z_stat.php?id=1281224882&web_id=1281224882"; - var s1 = document.getElementsByTagName("script")[0]; - s1.parentNode.insertBefore(hm1, s1); + if (window._czc) { + let location = window.location + let contentUrl = location.pathname + location.hash + let refererUrl = "/" + // 用于发送某个URL的PV统计请求 + window._czc.push(["_trackPageview", contentUrl, refererUrl]) + } next(); });