vue中友盟站長代碼統計實現

<template>
<div class="footer" id="foot">
        <p id="test" class="company">{{$t('other.footerDes')}}</p>
</div>
</template>
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])
        }
    }
}

實現效果php

相關文章
相關標籤/搜索