August 16, 2008

tracking user behavoir without javascript

the following is a scheme to track user movement without javascript. it could be used to help application testing and interface evaluation. or it could be used to track clicks without the A tag’s PING functionality.
client html
Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>scriptless ping</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type='text/css'>
	a { color: blue; }
	a.ping { background-image: url(""); }
	a.ping1:visited { background-image: url("http://192.168.8.2/pub/pinglog.asp?link=noaa.gov");  }
</style>
</head>

<body >

this will ping when you click the link: <a target="_blank" href='http://www.noaa.gov/' class="ping1">noaa</a>	<br />

</body>
</html>



server jscript (not cut-and-paste ready, but should demo the gist)
Code:

<!--#include file="XXX.asp"--> 
<script language="jscript" runat="server">

Response.ContentType="text/plain"

var dtt = ( new Date() ).toString();
var key=String(Request.querystring("link") ) || "" ;
var ipt=String(Request.ServerVariables("remote_addr")) || "err";
var uat=String(Request.ServerVariables("http_user_agent")) || "err";

var buff= ({ 	dt: dtt,
		ua :uat, 
		ip :ipt,
		link:key});

print( apFile("pinglog.txt" , buff.toSource() + ",\r\n" ) )

</script>





example of log file:
Code:

({dt:"Mon Jul 21 22:17:43 CDT 2008", ua:"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1", ip:"192.168.8.3", link:"noaa.gov"}),
({dt:"Mon Jul 21 22:20:28 CDT 2008", ua:"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506)", ip:"192.168.8.3", link:"noaa.gov"}),
({dt:"Mon Jul 21 22:30:36 CDT 2008", ua:"Mozilla/5.0 (Windows; U; Windows NT 6.0; en) AppleWebKit/522.15.5 (KHTML, like Gecko) Version/3.0.3 Safari/522.15.5", ip:"192.168.8.3", link:"noaa.gov"}),
({dt:"Mon Jul 21 22:29:10 CDT 2008", ua:"Mozilla/5.0 (Windows NT 6.0; U; en; rv:1.8.0) Gecko/20060728 Firefox/1.5.0 Opera 9.23", ip:"192.168.8.3", link:"noaa.gov"}),