vue中友盟站长代码统计实现

mounted() {
const script = document.createElement('script')
script.src = 'https://s95.cnzz.com/z_stat.php?id=1256769433&web_id=1256769433'
script.language = 'JavaScript'
document.getElementById('test').appendChild(script)
const script1 = document.createElement('script')
script1.src = 'https://c.cnzz.com/core.php?web_id=1256769433&t=z'
script1.language = 'JavaScript'
document.getElementById('test').appendChild(script1)
const a = document.createElement('a')
a.href = 'https://www.cnzz.com/stat/website.php?web_id=1256769433'
a.text = ' 站长统计'
a.title = '站长统计'
a.style = 'font-size:14px;color:#FFFFFF'
document.getElementById('test').appendChild(a)
}
,watch: {
    '$route' () {
        if (window._czc) {
            let location = window.location
            let contentUrl = location.pathname + location.hash
            let refererUrl = '/'
            window._czc.push(['_trackPageview', contentUrl, refererUrl])
        }
    }
}

实现效果

dfe173f8e6724ada9b89a3f45bff27ed6cb.jpg

vue中友盟站长代码统计实现_第1张图片

转载于:https://my.oschina.net/u/3459265/blog/3078214

你可能感兴趣的:(vue中友盟站长代码统计实现)