诸葛IO
-
诸葛IO产品介绍
诸葛io是数据智能收集,其核心在于对用户行为的深入分析与洞察,支持前端代码埋点、全埋点、可视化圈选埋点及服务端采集等多种技术方案,利用实时数据进行高效自动化运营的。
-
项目中如何使用
(1) jsp页面引用 js
<input type="hidden" id="zhugeKey" name="zhugeKey" value="${zhugeKey}"/>
<input type="hidden" id="zhugeIdentifyJson" name="zhugeIdentifyJson" value='${zhugeIdentifyJson}'/>
<script type="text/javascript" src="/_ui/responsive/js/components/zhuge/initZhuge.js"></script>
<script type="text/javascript" src="/_ui/responsive/js/components/zhuge/zhugeCommon.js"></script>
(2)initZhuge.js(安装诸葛SDK)
if(activeZhugeFlag === 'actived'){
//activeZhugeFlag 是自己项目诸葛的开关
//以下js是诸葛的SDK
window.zhuge = window.zhuge || [];
window.zhuge.methods = "_init identify track getDid getSid getKey setSuperProperty setUserProperties setPlatform".split(" ");
window.zhuge.factory = function (b) {
return function () {
var a = Array.prototype.slice.call(arguments);
a.unshift(b);
window.zhuge.push(a);
return window.zhuge;
};
};
for (var i = 0; i < window.zhuge.methods.length; i++) {
var key = window.zhuge.methods[i];
window.zhuge[key] = window.zhuge.factory(key);
}
window.zhuge.load = function (b, x) {
if (!document.getElementById("zhuge-js")) {
var a = document.createElement("script");
var verDate = new Date();
var verStr = verDate.getFullYear().toString() + verDate.getMonth().toString() + verDate.getDate().toString();
a.type = "text/javascript";
a.id = "zhuge-js";
a.async = !0;
a.src = "https://u2.zhugeio.com/zhuge.js?v=" + verStr;
a.onerror = function () {
//测试诸葛加载失败时,加个标志位
window.ACCLZG.isLoadSuccess = false;
window.zhuge.identify = window.zhuge.track = function (ename, props, callback) {
if (callback && Object.prototype.toString.call(callback) === '[object Function]') {
callback();
} else if (Object.prototype.toString.call(props) === '[object Function]') {
props();
}
};
};
var c = document.getElementsByTagName("script")[0];
c.parentNode.insertBefore(a, c);
window.zhuge._init(b, x);
}
};
var zhugeKey = document.getElementById('zhugeKey').value;
window.zhuge.load(zhugeKey,{
//启用全埋点采集(默认false)
autoTrack:true
});
}
(3)zhugeCommon.js(识别用户和使用)
//为用户设置一个识别码
var ZGID = JSON.parse(zhugeIdentifyJson);
zhuge.identify(ZGID.zhugeCurrentUserID,{
"用户类型":ZGID.zhugeCurrentUserType,
"ADA ID":ZGID.zhugeCurrentUserID,
"OpenID":ZGID.zhugeCurrentUserOpenID,
"unionID":ZGID.zhugeCurrentUserUnionID,
"sighupDate":ZGID.zhugeCurrentUserSighupDate
});
//记录事件
zhuge.track('页面_'+pageTitle,{
'事件类型':'页面浏览',
'页面类别':'其他',
'页面详情':pageTitle,
'访客类别':$D('#sessionValue_currentUserScope').val()||'Visitor'
});
- 总结
本文是记录诸葛IO的使用的一些心得,详细介绍可去:诸葛IO开发文档
转载自原文链接, 如需删除请联系管理员。
原文链接:项目上诸葛IO的使用,转载请注明来源!