var mouse_x = 0; var mouse_y = 0; var data = ""; var preData = ""; var saveData = ""; var preTime = new Date(); var startTime = new Date(); var value = []; var preValue = []; var unloadEventComp = 0; var slowScrollJikan = 0; var slowValue = 0; var preScrollPosition = null; var scrollMoveFlag = false; var startScrollPosition = null; var scrollData=""; var pause = false; var maxIdx=[]; var playMode = "front"; var step = false; var recTiming = 0.5; preValue.ScrollPosition = -1; preValue.windowHeight = -1; preValue.windowWidth = -1; preValue.mouseX = -1; preValue.mouseY = -1; preValue.height = -1; $(function(){ $(window).scroll(function(){ scrollMoveFlag = true; }); $("div").click(function(e){ e.stopPropagation(); var element_index = $("div").index(this); //要素のインデックス ret = getMousePosition(e,this); var mouse_x = ret.x; //要素内における、マウス位置 var mouse_y = ret.y; //要素内における、マウス位置 clickData += cipher(element_index) + "0" + cipher(mouse_x) + "0" + cipher(mouse_y) + ":"; }); if(analyzeFlag == false){ title_tag = $("title").text(); var contents_num = $(document.body).html().length; $.ajax({ type: "GET", url: "https://reliable-c.net/web_analyze/access?callback=recComp", data: {"url":location.href , "ref" : document.referrer , "uniqueID" : uniqueID, "title_tag" : title_tag,"contents_num" : contents_num , "firstAccessTime":firstAccessTime , "page_id" : ""}, dataType: "jsonp", crossDomain: true, success:function(data){ } }); } }) $(document).mousemove(function(e){ if(analyzeFlag == false){ mouse_x = e.clientX; mouse_y = e.clientY; } }) function postData(){ if(trans_byte > -1){ if(saveData != "" || scrollData != "" || clickData != ""){ if(date.getTime() - accessTimestamp >= 3600 * 1000){ uniqueID = date.getTime() + "_" + "13.58.172.97"; } trans_byte += saveData.length + scrollData.length + clickData.length; //console.log("trans_byte = " + trans_byte + "/" + 100000); if(trans_byte > 100000){ trans_byte = -1; } //console.log("saveData" + saveData); $.ajax({ type: "GET", url: "https://reliable-c.net/web_analyze/rec?callback=recComp", data: {"url":location.href , "savedata" : saveData , "scrolldata" : scrollData , "clickdata" : clickData,"uniqueID" : uniqueID,"maxScrollPosition":maxScrollPosition,"totalTaizaiJikan":totalTaizaiJikan}, dataType: "jsonp", crossDomain: true, success:function(data){ } }); saveData = ""; scrollData = ""; clickData = ""; } setTimeout(postData,5000); } } window.onbeforeunload = function() { if(analyzeFlag == false){ if(unloadEventComp == 0){ unloadEventComp = 1; postData(); } } } function rec(){ //0.5秒置きにここに来る var rec_flag = false; var ClientHeight = getClientHeight(); var ScrollHeight = getScrollHeight(); var ScrollPosition = getScrollPosition(); var height = ScrollHeight - ClientHeight; var nowTime = new Date(); var scrollPercent = Math.floor(ScrollPosition / height * 100); if(maxScrollPosition < scrollPercent) maxScrollPosition = scrollPercent; value.ScrollPosition = cipher(ScrollPosition); value.windowHeight = cipher($(window).height()); value.windowWidth = cipher($(window).width()); value.mouseX = cipher(mouse_x); value.mouseY = cipher(mouse_y); value.height = cipher(height); data =""; if(value.ScrollPosition != preValue.ScrollPosition){ data += value.ScrollPosition + "0"; rec_flag = true; }else{ data += "0"; } if(value.windowHeight != preValue.windowHeight || preValue.windowHeight == 0){ data += value.windowHeight + "0"; rec_flag = true; }else{ data += value.windowHeight + "0"; } if(value.windowWidth != preValue.windowWidth || preValue.windowWidth == 0){ data += value.windowWidth + "0"; rec_flag = true; }else{ data += value.windowWidth + "0"; } if(value.mouseX != preValue.mouseX){ data += value.mouseX + "0"; rec_flag = true; }else{ data += "0"; } if(value.mouseY != preValue.mouseY){ data += value.mouseY + "0"; rec_flag = true; }else{ data += "0"; } if(value.height != preValue.height){ data += value.height + ""; rec_flag = true; }else{ data += ""; } if(rec_flag == true){ Keika = Math.floor((nowTime.getTime()-preTime.getTime()) / 100); totalTaizaiJikan += Keika; saveData += cipher(Keika) + "0" + data + ":"; $("#saveData").val(saveData); $("#Byte").val((saveData.length) / 1000); $("#Keika").val(Math.floor((nowTime.getTime()-startTime.getTime()) / 1000 / 60)); preTime = new Date(); preValue.ScrollPosition = value.ScrollPosition; preValue.windowHeight = value.windowHeight; preValue.windowWidth = value.windowWidth; preValue.mouseX = value.mouseX; preValue.mouseY = value.mouseY; preValue.height = value.height; } preData = data; if(scrollMoveFlag && clickmap == false && scrollmap == false){ var scrollTop = getScrollPosition(); if(Math.abs(preScrollPosition - scrollTop) < 100){ //前回より100ピクセル未満の動きなら if(startScrollPosition == null){ startScrollPosition = scrollTop; } }else{ //精読終わり 前回より100ピクセル以上動いた setSlowData(scrollTop); startScrollPosition = null; } preScrollPosition = scrollTop; } if(analyzeFlag == false && totalTaizaiJikan < 3600){ if(trans_byte > -1){ setTimeout(rec,recTiming * 1000); } } } function setSlowData(endScrollPosition){ if(startScrollPosition != null){ scrollMoveFlag = false; preScrollPosition = null; scrollData += cipher(startScrollPosition) + "0" + cipher(endScrollPosition) + "0:"; console.log(scrollData); startScrollPosition = null; } } var clickData=""; if(analyzeFlag == false){ rec(); if(trans_byte > -1){ setTimeout(postData,5); } } function recComp(){ }