在頁(yè)面中首先引入相應(yīng)的js文件融师,html頁(yè)面中
<script>
var _hmt = _hmt || []
;(function() {
var hm = document.createElement('script')
hm.src =
'https://#/hm.js?<%= htmlWebpackPlugin.options.baiduCode %>'
var s = document.getElementsByTagName('script')[0]
s.parentNode.insertBefore(hm, s)
})()
</script>
然后在詳情的點(diǎn)擊事件中帽撑,加入?yún)?shù)即可
addOrderOutboundsBtn (opt) {
if(opt===1){
_hmt.push(['_trackEvent', '2C出庫(kù)新增保存', '點(diǎn)擊', localStorage.getItem('bdUid')])
}else if(opt===2){
_hmt.push(['_trackEvent', '2C出庫(kù)新增保存并下單', '點(diǎn)擊', localStorage.getItem('bdUid')])
}
然后就可以點(diǎn)擊查看啦
除此之外還有對(duì)相應(yīng)的page頁(yè)面進(jìn)行埋點(diǎn)統(tǒng)計(jì)
_hmt.push(['_trackPageview', '/order/inboundsWithTrunk/insert_' + localStorage.getItem('bdUid')]);