All pastes #1229353 Raw Edit

Woopra.com woopra.js Source

public javascript v1 · immutable
#1229353 ·published 2008-10-17 13:36 UTC
rendered paste body
var woopra_server_id = parseInt(woopra_id.substring(0,woopra_id.length - 8));var woopra_engine_host = "http://engine" + woopra_server_id + ".woopra.com";var woopra_static_host = "http://static.woopra.com";var chat_inited = 0;function _WaitFor(a){	var b = new Date();	var c = null;	do {		c = new Date();	}	while(c - b < a)}function _GetRandomString(){	chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ";	s = '';	for(var i = 0; i < 32; i++){		var a = Math.floor(Math.random() * chars.length);		s += chars.substring(a, a + 1)	}	return s;}function _GetNavigatorToken(){	if(window.opera || window.Opera){		return 'O';	}	if(navigator.userAgent){		return 'U';	}	return "X";}function _GetLanguageToken(){	return (navigator.browserLanguage || navigator.language || "");}function _GetMember(){	var x = "";	if(typeof woopra_name != "undefined"){		x = encodeURIComponent(woopra_name);	}	return x;}function _GetCookie(){	if(_ReadCookie("wooTracker")){		return _ReadCookie("wooTracker");	}	scookie = _GetRandomString();	_CreateCookie("wooTracker",scookie,'Thu, 2 Aug 2050');	rcookie = _ReadCookie("wooTracker");	if(scookie == rcookie){		return rcookie;	}	return '0'}function _GetSessionCookie(){	if(_ReadCookie("sessionCookie")){		return _ReadCookie("sessionCookie");	}	scookie = _GetRandomString();	_CreateCookie("sessionCookie", scookie);	rcookie = _ReadCookie("sessionCookie");	if(scookie == rcookie){		return rcookie;	}	return '0';}function _ReadCookie(a){	var b = "" + document.cookie;	var c = b.indexOf(a);	if(c == -1 || a == ""){		return "";	}	var d = b.indexOf(';',c);	if(d == -1){		d = b.length;	}	return unescape(b.substring(c + a.length + 1, d));}function _CreateCookie(a, b, c){	cookieval = a + '=' + b + '; ' + ((c)?('expires=' + c + ' ;'):'') + 'path=/';	document.cookie = cookieval}function WoopraEvent(a,b){	script = document.createElement('script');	script.type = "text/javascript";	script.src = woopra_engine_host + '/customevent/cookie=' + _GetCookie() + '&type=' + encodeURIComponent(a) + '&name=' + encodeURIComponent(b) + "&ra=" + _GetRandomString();	document.getElementsByTagName('head')[0].appendChild(script);}function _TrackLinkClicks(){	if(document.addEventListener){		document.addEventListener("mousedown",_TrackClick,false);	} else {		if(document.attachEvent){			document.attachEvent("onmousedown",_TrackClick)		}	}}function _TrackClick(e){	var a = (e.srcElement) ? e.srcElement : e.target;	if(a.tagName == "A"){		_ProcessClick(a);	}}function _ProcessClick(a){	var b = a.pathname.match(/(?:doc|eps|jpg|png|svg|xls|ppt|pdf|xls|zip|txt|vsd|vxd|js|css|rar|exe|wma|mov|avi|wmv|mp3)($|\&)/);	if(b){		WoopraEvent("DOWNLOAD",a.href);		_WaitFor(300);	} else {		if(a.hostname != location.host){			WoopraEvent("EXIT",a.href);			_WaitFor(400);		}	}}function _ChatTest(){	if(document.getElementById('woo_chat_frame')){		return;	}	script = document.createElement('script');	script.type = 'text/javascript';	script.src = woopra_engine_host + '/ping/cookie=' + _GetCookie() + "&ra=" + _GetRandomString();	document.getElementsByTagName('head')[0].appendChild(script);}function _InitChat(){	if(chat_inited == 1){		return;	}	chat_inited = 1;	script = document.createElement('script');	script.type = 'text/javascript';	script.src = woopra_static_host + "/js/woopra_chat.js";	document.getElementsByTagName('head')[0].appendChild(script);}function _WoopraVisit(){	script = document.createElement('script');	script.type = 'text/javascript';	script.src = woopra_engine_host + '/visit/sessioncookie=' + _GetSessionCookie() + '&cookie=' + _GetCookie() + '&browsertoken=' + _GetNavigatorToken() + '&platformtoken=' + encodeURIComponent(navigator.platform) + '&language=' + _GetLanguageToken() + '&pagetitle=' + encodeURIComponent(document.title) + '&referer=' + encodeURIComponent(document.referrer) + '&screen=' + encodeURIComponent(screen.width + 'x' + screen.height) + '&woopraname=' + _GetMember() + "&ra=" + _GetRandomString();	document.getElementsByTagName('head')[0].appendChild(script);}_WoopraVisit();_TrackLinkClicks();