百度网页关键字抓取(js获取访客百度搜索词最新方法此方法不仅可以实时监控访客 )
优采云 发布时间: 2022-03-18 13:31百度网页关键字抓取(js获取访客百度搜索词最新方法此方法不仅可以实时监控访客
)
js获取访问者百度搜索词的最新方法
该方法不仅可以在搜索登陆页面获取百度的访问者搜索词关键词,还可以在进入页面后在任意浏览页面快速获取该访问者的搜索引擎和搜索关键词。 .
如果需要实时监控访客搜索关键词数据,请参考上一篇博客:
如何获取1.在易巢客服系统注册账号()2.登录易巢客服系统获取js码
3.在需要获取关键字的页面添加代码
var _echatServer = ['www.echatsoft.com'];
window._echat=window._echat||function(){(_echat.q=_echat.q||[]).push(arguments)};_echat.l=+new Date;
_echat('initParam', { companyId: 1});
(function () {
var echat = document.createElement('script');
echat.type = 'text/javascript';
echat.async = true;
echat.id = 'echatmodulejs';
echat.setAttribute('charset','UTF-8');
echat.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'www.echatsoft.com/visitor/echat.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(echat, s);
})();
4.添加访客信息监控
_echat('on', {
newEvent: function (data) {
//事件*敏*感*词*
if(data.eventCategory == 'echat' && data.eventAction == 'visitorTrackInfo'){
console.log("访客所在国家:" + (data.eventLabel.country || ""));
console.log("访客所在省份:" + (data.eventLabel.province || ""));
console.log("访客所在城市:" + (data.eventLabel.city || ""));
console.log("访客使用搜索引擎:" + (data.eventLabel.searcher || ""));
console.log("访客搜索关键字:" + (data.eventLabel.keyword || ""));
if(data.eventLabel.searcher == 'baidu' && data.eventLabel.keywordType){
console.log("访客点击类型:" + (data.eventLabel.keywordType == 0?"未知":(data.eventLabel.keywordType == 2 ? "竞价":"SEO")))
}
}
}
});
百度搜索“一键客服系统”两次,打印结果如下:
访客所在国家:中国
访客所在省份:四川省
访客所在城市:成都市
访客使用搜索引擎:baidu
访客搜索关键字:
访客所在国家:中国
访客所在省份:四川省
访客所在城市:成都市
访客使用搜索引擎:baidu
访客搜索关键字:一洽客服系统
访客点击类型:SEO