在vue 服务端渲染项目中,怎么添加统计代码,我在模板文件加入了
<script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_1260898486'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s95.cnzz.com/z_stat.php%3Fid%3D1260898486%26show%3Dpic1' type='text/javascript'%3E%3C/script%3E"));</script>
然后在app.vue 中也添加了事件
watch: {
'$route'() {
if (window._czc) {
let location = window.location
let contentUrl = location.pathname + location.hash
let refererUrl = '/'
window._czc.push(['_trackPageview', contentUrl, refererUrl])
}
},
},
可是实际上我上友盟后台看,页面并没有被统计到,只统计到了几个而已。
控制台上看每页都是有请求到cnzz的