vue中使用友盟统计,统计到每个路由
只需在app.vue中加上此段代码mounted(){const script = document.createElement('script');script.src = 'https://s65.cnzz.com/z_stat.php?id=1275785147&web_id=1275785147';//友盟中的代码script.lan...
·
只需在app.vue中加上此段代码
mounted(){
const script = document.createElement('script');
script.src = 'https://s65.cnzz.com/z_stat.php?id=1275785147&web_id=1275785147';//友盟中的代码
script.language = 'JavaScript';
document.body.appendChild(script);
},
watch: {
'$route' () {
if (window._czc) {
// window._czc.push(["_setAutoPageview", false]);
let location = window.location;//路由变化
let contentUrl = location.hash;//自定义当前url,可带上路由以此区分每个页面
// console.log(contentUrl);
let refererUrl = '/';
window._czc.push(["_setAutoPageview", false]);
window._czc.push(["_trackPageview", contentUrl, refererUrl])
}
}
更多推荐
已为社区贡献14条内容
所有评论(0)