1)、config.js中添加
* //PV跟踪,查看"最新访客"和"受访页面"等报告
var _hmt =_hmt||[];
//统计代码
var BaiduTongJi = {
visitPage : function (_path)
{// _trackPageview参数_path需要是相对路径
_hmt.push(['_trackPageview', _path]);
}
};
$rootScope.$on('$locationChangeSuccess', function () {
var path = window.location.href.replace(window.location.origin,'');
BaiduTongJi.visitPage(path);
});
* 每个交易页面,当发送交易时,向_hmt存储内容,添加事件跟踪
_hmt.push(['_trackEvent', '充值', 'click']);
2)、index页面引入百度统计js
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?3F01234567890ABCDEF01234567890ABCDEF";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
百度统计的详细文档请参考https://tongji.baidu.com/open/
angularjs中使用百度统计
最新推荐文章于 2025-01-10 09:58:25 发布
2958

被折叠的 条评论
为什么被折叠?



