修改统计代码

This commit is contained in:
A1300399510
2023-12-15 11:23:33 +08:00
parent 51c7932205
commit 62677e7c81
7 changed files with 159 additions and 135 deletions

File diff suppressed because one or more lines are too long

View File

@@ -131,6 +131,8 @@ const router = createRouter({
})
let isInitialNavigation = false
router.beforeEach((to, from, next) => {
//进度条开始
NProgress.start();
@@ -142,20 +144,25 @@ router.beforeEach((to, from, next) => {
let title = meta['title']
if (title) setSeoTitle(title)
if (window._hmt) {
if (to.path) {
// window._hmt.push(['_trackPageview', '/#' + to.fullPath])
window._hmt.push(['_trackPageview', to.fullPath])
if (isInitialNavigation) {
isInitialNavigation = false
} else {
return
console.log("1111111,", to.path, to.fullPath);
if (window._hmt) {
if (to.path) {
// window._hmt.push(['_trackPageview', '/#' + to.fullPath])
window._hmt.push(['_trackPageview', to.fullPath])
}
}
}
if (window._czc) {
let location = window.location
let contentUrl = location.pathname + location.hash
let refererUrl = "/"
// 用于发送某个URL的PV统计请求
window._czc.push(["_trackPageview", contentUrl, refererUrl])
if (window._czc) {
let location = window.location
let contentUrl = location.pathname + location.hash
let refererUrl = "/"
// 用于发送某个URL的PV统计请求
window._czc.push(["_trackPageview", contentUrl, refererUrl])
}
}
})