(file) Return to awstats_misc_tracker.js CVS log (file) (dir) Up to [RizwankCVS] / geekymedia_web / awstats-6.3 / wwwroot / js

  1 rizwank 1.1 // awstats_misc_tracker.js
  2             //-------------------------------------------------------------------
  3             // You can add this file onto some of your web pages (main home page can
  4             // be enough) by adding the following HTML code to your page body:
  5             //
  6             // <script language=javascript src="/js/awstats_misc_tracker.js"></script>
  7             // <noscript><img src="/js/awstats_misc_tracker.js?nojs=y" height=0 width=0 border=0 style="display: none"></noscript>
  8             //
  9             // * This must be added after the <body> tag, not placed within the
 10             //   <head> tags, or the resulting tracking <img> tag will not be handled
 11             //   correctly by all browsers.  Internet explorer will also not report
 12             //   screen height and width attributes until it begins to render the
 13             //   body.
 14             //
 15             // This allows AWStats to be enhanced with some miscellanous features:
 16             // - Screen size detection (TRKscreen)
 17             // - Browser size detection (TRKwinsize)
 18             // - Screen color depth detection (TRKcdi)
 19             // - Java enabled detection (TRKjava)
 20             // - Macromedia Director plugin detection (TRKshk)
 21             // - Macromedia Shockwave plugin detection (TRKfla)
 22 rizwank 1.1 // - Realplayer G2 plugin detection (TRKrp)
 23             // - QuickTime plugin detection (TRKmov)
 24             // - Mediaplayer plugin detection (TRKwma)
 25             // - Acrobat PDF plugin detection (TRKpdf)
 26             //-------------------------------------------------------------------
 27             
 28             // If you use pslogger.php to generate your log, you can change this line with
 29             // var awstatsmisctrackerurl="pslogger.php?loc=/js/awstats_misc_tracker.js";
 30             var awstatsmisctrackerurl="/js/awstats_misc_tracker.js";
 31             
 32             function awstats_setCookie(TRKNameOfCookie, TRKvalue, TRKexpirehours) {
 33             	var TRKExpireDate = new Date ();
 34               	TRKExpireDate.setTime(TRKExpireDate.getTime() + (TRKexpirehours * 3600 * 1000));
 35               	document.cookie = TRKNameOfCookie + "=" + escape(TRKvalue) + "; path=/" + ((TRKexpirehours == null) ? "" : "; expires=" + TRKExpireDate.toGMTString());
 36             }
 37             
 38             function awstats_detectIE(TRKClassID) {
 39             	TRKresult = false;
 40             	document.write('<SCR' + 'IPT LANGUAGE=VBScript>\n on error resume next \n TRKresult = IsObject(CreateObject("' + TRKClassID + '"))</SCR' + 'IPT>\n');
 41             	if (TRKresult) return 'y';
 42             	else return 'n';
 43 rizwank 1.1 }
 44             
 45             function awstats_detectNS(TRKClassID) {
 46             	TRKn = "n";
 47             	if (TRKnse.indexOf(TRKClassID) != -1) if (navigator.mimeTypes[TRKClassID].enabledPlugin != null) TRKn = "y";
 48             	return TRKn;
 49             }
 50             
 51             function awstats_getCookie(TRKNameOfCookie){
 52             	if (document.cookie.length > 0){
 53             		TRKbegin = document.cookie.indexOf(TRKNameOfCookie+"=");
 54             	    if (TRKbegin != -1) {
 55             			TRKbegin += TRKNameOfCookie.length+1; 
 56             			TRKend = document.cookie.indexOf(";", TRKbegin);
 57             			if (TRKend == -1) TRKend = document.cookie.length;
 58                 	  	return unescape(document.cookie.substring(TRKbegin, TRKend));
 59             		}
 60             		return null; 
 61               	}
 62             	return null; 
 63             }
 64 rizwank 1.1 
 65             if (window.location.search == "" || window.location.search == "?") {
 66                 // If no query string
 67             	TRKnow = new Date();
 68             	TRKscreen=screen.width+"x"+screen.height;
 69             	if (navigator.appName != "Netscape") {TRKcdi=screen.colorDepth}
 70             	else {TRKcdi=screen.pixelDepth};
 71             	TRKjava=navigator.javaEnabled();
 72             	TRKuserid=awstats_getCookie("AWSUSER_ID");
 73             	TRKsessionid=awstats_getCookie("AWSSESSION_ID");
 74             	var TRKrandomnumber=Math.floor(Math.random()*10000);
 75             	if (TRKuserid == null || (TRKuserid=="")) {TRKuserid = "awsuser_id" + TRKnow.getTime() +"r"+ TRKrandomnumber};
 76             	if (TRKsessionid == null || (TRKsessionid=="")) {TRKsessionid = "awssession_id" + TRKnow.getTime() +"r"+ TRKrandomnumber};
 77             	awstats_setCookie("AWSUSER_ID", TRKuserid, 10000);
 78             	awstats_setCookie("AWSSESSION_ID", TRKsessionid, 1);
 79             	TRKuserid=""; TRKuserid=awstats_getCookie("AWSUSER_ID");
 80             	TRKsessionid=""; TRKsessionid=awstats_getCookie("AWSSESSION_ID");
 81             	
 82             	var TRKagt=navigator.userAgent.toLowerCase();
 83             	var TRKie  = (TRKagt.indexOf("msie") != -1);
 84             	var TRKns  = (navigator.appName.indexOf("Netscape") != -1);
 85 rizwank 1.1 	var TRKwin = ((TRKagt.indexOf("win")!=-1) || (TRKagt.indexOf("32bit")!=-1));
 86             	var TRKmac = (TRKagt.indexOf("mac")!=-1);
 87             
 88                 // Detect the browser internal width and height
 89                 if (document.documentElement && document.documentElement.clientWidth)
 90                     TRKwinsize = document.documentElement.clientWidth + 'x' + document.documentElement.clientHeight;
 91                 else if (document.body)
 92                     TRKwinsize = document.body.clientWidth + 'x' + document.body.clientHeight;
 93                 else
 94                     TRKwinsize = window.innerWidth + 'x' + window.innerHeight;
 95             	
 96             	if (TRKie && TRKwin) {
 97             		var TRKshk = awstats_detectIE("SWCtl.SWCtl.1")
 98             		var TRKfla = awstats_detectIE("ShockwaveFlash.ShockwaveFlash.1")
 99             		var TRKrp  = awstats_detectIE("rmocx.RealPlayer G2 Control.1")
100             		var TRKmov = awstats_detectIE("QuickTimeCheckObject.QuickTimeCheck.1")
101             		var TRKwma = awstats_detectIE("MediaPlayer.MediaPlayer.1")
102             		var TRKpdf = 'n'; 
103                     if (awstats_detectIE("PDF.PdfCtrl.1") == 'y') { TRKpdf = 'y'; }
104             	    if (awstats_detectIE('PDF.PdfCtrl.5') == 'y') { TRKpdf = 'y'; }
105             		if (awstats_detectIE('PDF.PdfCtrl.6') == 'y') { TRKpdf = 'y'; }
106 rizwank 1.1 	}
107             	if (TRKns || !TRKwin) {
108             		TRKnse = ""; for (var TRKi=0;TRKi<navigator.mimeTypes.length;TRKi++) TRKnse += navigator.mimeTypes[TRKi].type.toLowerCase();
109             		var TRKshk = awstats_detectNS("application/x-director")
110             		var TRKfla = awstats_detectNS("application/x-shockwave-flash")
111             		var TRKrp  = awstats_detectNS("audio/x-pn-realaudio-plugin")
112             		var TRKmov = awstats_detectNS("video/quicktime")
113             		var TRKwma = awstats_detectNS("application/x-mplayer2")
114             		var TRKpdf = awstats_detectNS("application/pdf");
115             	}
116             	document.write('<img src="'+awstatsmisctrackerurl+'?screen='+TRKscreen+'&win='+TRKwinsize+'&cdi='+TRKcdi+'&java='+TRKjava+'&shk='+TRKshk+'&fla='+TRKfla+'&rp='+TRKrp+'&mov='+TRKmov+'&wma='+TRKwma+'&pdf='+TRKpdf+'&uid='+TRKuserid+'&sid='+TRKsessionid+'" height=0 width=0 border=0>')
117             
118             }

Rizwan Kassim
Powered by
ViewCVS 0.9.2