Thursday, March 22, 2012

Site Tracking

I would like to capture theScreen Resolution of a site visitor's computer when he/she visits the site. Capturing theScreen Resolution is something that is not included in Request.ServerVariables, and I don't have a clue how to get it. Any help would be appreciated!

The only reliable way to get their resolution is through a little javascript.

 <script type="text/javascript" language="javascript"> function getRez() { var txt1 = document.getElementById("txt1"); var txt2 = document.getElementById("txt2"); txt1.value = screen.width; txt2.value = screen.height; } </script></head><body onload="getRez()"> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server" /> Width :<asp:TextBox id="txt1" runat="server"></asp:TextBox><br /> Height :<asp:TextBox ID="txt2" runat="server"></asp:TextBox> </div> </form></body>

Thanks, that did the trick!


I utilize google analytics (http://www.google.com/analytics) and it provides all the statistics that anyone could need for a site, free of charge.

0 comments:

Post a Comment