var Wisedu = window.Wisedu || {}; Wisedu.userActionDataSend = function () { var userNewAnalysisDataJson = { schoolId: "Other", userId: "guest", userName: "Other", userType: "Other", userDepartment: "Other", userSex: "Other", siteType: "Other" }; var CommonUtil = { logError: function (e) { if (window.console) { console.log(e.message); } }, isEmpty: function (o) { return ((null == o) || (undefined == o) || ("" == o) || (o.length < 1)); }, sendDataByNewAnalysis: function () { try { var userId = userNewAnalysisDataJson.userId; AmpUtils.dataAnalysis(userId, userNewAnalysisDataJson, 'identify'); } catch (e) { this.logError(e); } } }; var InitData = { setUserId: function () { var userId = ""; try { var userIdFlag = "ampUserId"; userId = sessionStorage[userIdFlag]; if (CommonUtil.isEmpty(userId)) { userId = document.getElementById("analysisUserId").value; sessionStorage[userIdFlag] = userId; } } catch (e) { userId = "guest"; CommonUtil.logError(e); } userNewAnalysisDataJson.userId = userId; }, setUserName: function () { var userName = ""; try { var userNameFlag = "ampUserName"; userName = sessionStorage[userNameFlag]; if (CommonUtil.isEmpty(userName)) { userName = document.getElementById("analysisUserName").value; sessionStorage[userNameFlag] = userName; } } catch (e) { userName = "other"; CommonUtil.logError(e); } userNewAnalysisDataJson.userName = userName; }, setUserType: function () { var userType = "other"; try { userType = sessionStorage["ampUserTypeName"] ? sessionStorage["ampUserTypeName"] : "other"; } catch (e) { userType = "other"; CommonUtil.logError(e); } userNewAnalysisDataJson.userType = userType; }, setUserDepartment: function () { var userDepartment = "other"; try { userDepartment = sessionStorage["ampUserDepartment"] ? sessionStorage["ampUserDepartment"] : "other"; } catch (e) { userDepartment = "other"; CommonUtil.logError(e); } userNewAnalysisDataJson.userDepartment = userDepartment; }, setUserSex: function () { var userSex = "other"; try { userSex = sessionStorage["ampUserSex"] ? sessionStorage["ampUserSex"] : "other"; } catch (e) { userSex = "other"; CommonUtil.logError(e); } userNewAnalysisDataJson.userSex = userSex; }, setSiteType: function () { var siteType = "other"; try { siteType = sessionStorage["ampSiteType"] ? sessionStorage["ampSiteType"] : "other"; } catch (e) { siteType = "other"; CommonUtil.logError(e); } userNewAnalysisDataJson.siteType = siteType; }, init: function () { try { userNewAnalysisDataJson.schoolId = AMPConfigure.schoolId; this.setUserId(); this.setUserName(); this.setUserType(); this.setUserDepartment(); this.setUserSex(); this.setSiteType(); } catch (e) { CommonUtil.logError(e); } } }; try { InitData.init(); CommonUtil.sendDataByNewAnalysis(); //glhan发送到新的统计分析 } catch (e) { CommonUtil.logError(e); } };