호스팅 [나누미넷] 웹로그분석 함수
페이지 정보
본문
나누미넷 ( www.nanuminet.com ) 에서 제공하는 Web Analyzer 사용하기
플래시를 이용한 클릭 분석은 이동할 URL을, 플래시내 'on(release)' 이벤트 부분의 'getURL()'에 삽입
1. 클릭하면 현재창이 변경되면서 클릭분석하고자 할때
on (release) {
getURL("javascript:_hwaClick('분석코드','https://www.happyjung.com')");
}
2. 클릭하면 새창이 뜨면서 클릭분석하고자 할때
on (release) {
getURL("javascript:_hwaClickW('분석코드','https://www.happyjung.com')");
}
3. 기타 함수
function _hwaTracker() {
if (_hdl.protocol == "file:") return;
var s="", trf = "", turl="", rf="", url="";
_hwaDomain();
var is_exist = false;
for (var i=0; i < _hsd.length; i++) {
if (_hdn.indexOf(_hsd[i]) != -1) {
is_exist = true;
break;
}
}
if (!is_exist) return;
var d = new Date();
_hdt = d.getTime();
s += "ut="+_hdt;
_hrf = _hdo.referrer;
eval("try{ trf = top.document.referrer; }catch(_e){}");
eval("try{ turl = top.document.location.href; }catch(_e){}");
if (_hrf == turl) _hrf = trf;
_hrf = _hwaUnescape(_hrf);
_hrf = _hrf.replace (/[&]/g, ';');
s += "&rf="+_hrf;
url = _hdl.href;
url = url.replace (/[&]/g, ';');
s += "&url="+url;
s += _hwaCookieInit();
s += _hwaGetConfig();
var i=new Image();
i.src=_hsu+"/process.php?"+s;
i.onload=function() { return;};
}
function _hwaDomain() {
var d = _hdo.domain;
if (d.substring(0,4) == "www.") {
d = d.substring(4, d.length);
}
_hdn = d;
}
function _hwaUnescape(str) {
var re = /(\%u[A-Z0-9]{4})/g;
var m = str.match(re);
if (m != null) {
var tu = m.length;
for (var i=0; i < tu; i++) {
str = str.replace(m[i], unescape(m[i]));
}
}
return str;
}
function _hwaGetCookie(sName) {
var aCookie = _hdo.cookie.split("; ");
var cookie_len = aCookie.length;
for (var i=0; i < cookie_len; i++) {
var aCrumb = aCookie[i].split("=");
if (sName == aCrumb[0]) {
return unescape(aCrumb[1]);
}
}
return null;
}
function _hwaSetCookie (name, value, expDays, path) {
_hdo.cookie = name + "=" + escape(value) +
((expDays == null) ? "" : ("; expires=" + expDays.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((_hdn == "") ? "" : ("; domain=" + _hdn));
}
function _hwaRemoveCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = _hwaGetCookie (name);
_hdo.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
function _hwaSetDatetime (expDays) {
var expDate = new Date();
expDate.setTime(expDate.getTime() + (86400 * 1000 * expDays));
return expDate;
}
function _hwaCookieInit() {
var s="";
var count = _hwaGetCookie('hwatime');
var unique = _hwaGetCookie('hwaunique');
if (unique == null) {
_huq = 1;
var utime = new Date();
utime.setHours(23);
utime.setMinutes(59);
utime.setSeconds(59);
utime.setMilliseconds(999);
_hwaSetCookie('hwaunique', 1, utime, "/");
}
if (count == null) {
_hwaSetCookie('hwatime', _hdt, _hwaSetDatetime(365), "/");
}
else {
var found = 0;
var reg = new RegExp("^http[s]?:\/\/([-a-z0-9]+\.)?" + _hdn, "ig");
if (_hrf && reg.test(_hrf)) { found = 1; }
if (found) { _hld = -1; }
else { _hld = _hwaGetCookie('hwatime'); }
_hwaRemoveCookie('hwatime');
_hwaSetCookie('hwatime', _hdt, _hwaSetDatetime(365), "/");
}
if (_hld == null) _hld = 0;
s += "&lv="+_hld+"&uq="+_huq;
return s;
}
function _hwaGetConfig() {
var s="";
var n = navigator;
var an = n.appName;
var ua = n.userAgent;
var ua2 = ua.toLowerCase();
var moz = (an.indexOf("Netscape") != -1);
var ie = (ua2.indexOf("msie") != -1);
var win = ((ua2.indexOf("win")!=-1) || (ua2.indexOf("32bit")!=-1));
var jv = n.javaEnabled() ? "1" : "0";
var ck = n.cookieEnabled ? "1" : "0";
s+="&jv="+jv+"&ck="+ck;
var cd = window.screen.colorDepth;
var rs = window.screen.width+"X"+window.screen.height;
var ln = (n.language) ? n.language : n.browserLanguage;
ln = ln.toLowerCase();
s+="&cd="+cd+"&rs="+rs+"&ln="+ln+"&ua="+ua;
return s;
}
function _hwaSearch(_rcode, val) {
var len = _rcode.length;
for (var i=0; i < len; i++) {
if (_rcode[i] == val) return i;
}
return -1;
}
function _hwaClick(cc, url) {
var i = new Image();
i.src = _hsu+"/ckTracker.php?cc="+cc;
i.onload=function() { return;};
if (url != undefined) document.location.href = url;
}
function _hwaClickW(cc, url) {
var i = new Image();
i.src = _hsu+"/ckTracker.php?cc="+cc;
i.onload=function() { return;};
if (url != undefined) window.open(url);
}
function _hwaAd(gc, ac, url) {
var utime = new Date();
var atime = utime.getTime();
utime.setHours(23);
utime.setMinutes(59);
utime.setSeconds(59);
utime.setMilliseconds(999);
var code = gc+"_"+ac;
var _rcode = new Array();
var _rtime = new Array();
var refresh = false;
var adcode = _hwaGetCookie('hwa_ad_code');
if (adcode == null) {
_rcode[0] = code;
_rtime[0] = atime;
refresh = true;
} else {
var adtime = _hwaGetCookie('hwa_ad_time');
_rcode = adcode.split("|");
_rtime = adtime.split("|");
var _si = -1;
if ((_si = _hwaSearch(_rcode, code)) >= 0) {
var _adtime = _rtime[_si];
if ((atime-_adtime) > (_utimeout*1000)) {
_rtime[_si] = atime;
refresh = true;
}
} else {
var cl = _rcode.length;
var tl = _rtime.length;
_rcode[cl] = code;
_rtime[tl] = atime;
refresh = true;
}
}
if (refresh) {
var rcode = _rcode.join("|");
var rtime = _rtime.join("|");
_hwaSetCookie('hwa_ad_code', rcode, utime, "/");
_hwaSetCookie('hwa_ad_time', rtime, utime, "/");
var i = new Image();
i.src = _hsu+"/adTracker.php?gc="+gc+"&ac="+ac;
i.onload=function() { return;};
}
if (url != undefined) document.location.href = url;
}
댓글목록
등록된 댓글이 없습니다.