Vue中添加友盟代码统计

本文最后更新于:2023年3月29日 下午

如下图所示: image

image

在入口 App.vue 中添加代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<script>
export default {
name: 'app',
mounted () {
const script = document.createElement('script')
script.src = 'https://s95.cnzz.com/z_stat.php?id=1111111111&web_id=1111111111'
script.language = 'JavaScript'
document.body.appendChild(script)
},
watch: {
'$route' () {
if (window._czc) {
let location = window.location
let contentUrl = location.pathname + location.hash
let refererUrl = '/'
window._czc.push(['_trackPageview', contentUrl, refererUrl])
}
}
}
}
</script>


如果这篇文章对你有帮助,或者想给我微小的工作一点点资瓷,请随意打赏。
潘高 微信支付

微信支付

潘高 支付宝

支付宝


Vue中添加友盟代码统计
https://blog.pangao.vip/Vue中添加友盟代码统计/
作者
潘高
发布于
2018年11月1日 上午
更新于
2023年3月29日 下午
许可协议