window.onload = function(){ if(typeof jQuery == 'undefined') { var jqueryElement = document.createElement('script'); jqueryElement.src = '//code.jquery.com/jquery-1.7.2.min.js'; jqueryElement.onload = function(){ //여기에 jquery를 이용한 스크립트를 입력하면 됩니다. //$("body").html("여기에 들어갑니다."); } document.getElementsByTagName('head')[0].appendChild(jqueryElement); } //trace.sendLog(); } var trace_load=null; var trace = new function(){ this.device=function(){ var ret = 'PC'; if(navigator.userAgent.match(/Android|Mobile|iP(hone|od|ad)|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/)){ ret = 'M';//mobile if(navigator.userAgent.match(/Android|iPad/)){ ret = 'T';//tablet } } return ret; }, this.sendLog=function(){ var sid = trace.cookie('SESSID'); if(trace.cookie('SESSID')==''){ sid = trace.guid(); document.cookie="SESSID="+ sid +"; expires=0; path=/"; } var actcode = (typeof(trace.actcode)!='undefined' ? encodeURIComponent(trace.actcode) : ''); var action_name = (typeof(trace.act)!='undefined' ? encodeURIComponent(trace.act) : ''); var sendData = ""; sendData += '&sid='+ sid; sendData += '&scode='+encodeURIComponent(trace.sitecode); sendData += '&path='+encodeURIComponent(trace.path); sendData += '&actcode='+ actcode; sendData += '&act='+ action_name; sendData += '&pj='+encodeURIComponent(trace.pj); sendData += '&refer='+ (trace.cookie('sid_yn')=='' ? encodeURIComponent(document.referrer) : ''); sendData += '&agent='+ (trace.cookie('sid_yn')=='' ? encodeURIComponent(navigator.userAgent) : ''); // sendData += '&device='+ (trace.cookie('sid_yn')=='' ? trace.device() : ''); sendData += '&mseq='+encodeURIComponent(trace.mem_seq); sendData += '&pgname='+encodeURIComponent(trace.pgname); sendData += '&ip='+ (trace.cookie('sid_yn')=='' ? '18.217.182.45' : ''); sendData += '&url='+ encodeURIComponent(location.pathname + location.search); sendData += '&host='+ encodeURIComponent(location.host); if((trace_load==null || action_name!='')){ //document.cookie="ing=Y; expires=0; path=/"; //전송중 상태값. $.ajax({ type:'get' ,dataType:'jsonp' ,url:'//counter.daara.kr/log.php' ,data:sendData ,jsonpCallback:'callback' ,success:function(){ //document.cookie="ing=N; expires=-1; path=/"; } ,error:function(xhr,st,err){ } ,timeout: 2000 // sets timeout to 3 seconds }); document.cookie="sid_yn=Y; expires=0; path=/"; trace_load='Y'; } }, this.action=function(){ $('.act-trace-action').on('click submit',function(e){ trace.act = $(this).attr('data-action') ; trace.actcode = $(this).attr('data-actcode'); //console.log(trace.act); //console.log(trace.actcode); trace.sendLog(); }); }, this.cookie=function(c){ var val=''; var name = c + "="; var ca = document.cookie.split(';'); for(var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0)==' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { val= c.substring(name.length,c.length); break; } } return val; }, this.guid = function(){ function s4(){ return ((1 + Math.random()) * 0x10000 | 0).toString(16).substring(1); } var uuid = s4() + s4() + s4() + s4() + s4() + s4(); //document.cookie="uuid="+ uuid +"; expires=0; path=/"; return uuid; } } if(trace.cookie('SESSID')==''){ var sid = trace.guid(); document.cookie="SESSID="+ sid +"; expires=0; path=/"; } trace.action();