pFRONT.com Development  
Login Now   /dev :: home :: articles :: statisticus - part #4   5 Visitors Online

  


 

Statisticus, Why and How?
Part IV - Adding More Fields

by Pascal Hagen

4. Adding More Fields

By adding some more fields to our table, we will get some more statistics such as mostly used screen resolutions and color depths. It is very valuable piece of information. How do you feel about being stuck with that 216-safe color palette? Should you stay within safe palette or your visitors run in high color mode with more than 800x600 resolution? Well, here's how to learn:

Client-side scripting gives you the ability to directly talk to the browser and ask about the environment. We will use JavaScript to do that.

<script language="JavaScript" type="text/javascript"> <!-- f = "" + escape(document.referrer); v = navigator.appName; if (v=='Netscape') {b = 'NS';} if (v=='Microsoft Internet Explorer') {b = 'MSIE';} if (navigator.appVersion.indexOf('MSIE 3')>0) {b = 'MSIE';} u = "" + escape(document.URL); w = screen.width; h = screen.height; if (v != "Netscape") {c=screen.colorDepth;} else {c=screen.pixelDepth;} info= "w=" + w + "&h=" + h + "&c=" + c + "&r= " + f + "&u="+ u + "&b=" + b document.write("<img src=\"/count.asp?" + info + "\">"); --> </script>

What we actually do here is a little bit tricky, we call an asp page externally! We tell the browser that our asp page (count.asp) is an image. We will do what we say to the browser, but first we will have a look at the information we are sending to count.asp.

Our count.asp file, which is responsible for storing the data to the table needs to catch the following variables;

w: screen width
h: screen height
c: color depth (in bits)
r: referer
u: url of the page
b: browser brand

We had used Request.Servervariables("script_name") before, why sending URL again? Answer is simple, script_name will always return count.asp because we are making a tricky external call to it. This is why we should send the url.

Now, in count.asp, it's easy to store the variables into the table.

After running such a counter for a long time, you'll see that the database size grows and grows. What should we do? We don't want to give up our new fields, but we need to somehow use less bytes. A kind of compression? No, it's called data normalization.

Part I - Introduction
Part II - Measurement Tools
Part III - Simple Statistics
Part IV - Adding More Fields
Part V - Data Normalization
Part VI - Data Gets Valuable



 

Advertise
Advertise here

Connect

Thinkcyber
Thinkcyber.net
DXXS
Premium Hosting
Earth Day Savings
Loja COSMETICA
SFD Brazil
5Z Brazil
Drogstoreshopping
Betterman
Betterwoman
NYC SoKKer
Avacor


Sponsor
Become a sponsor.

 
Premium Hosting
Secure
Affordable
Reliable

Contact


You can send this page to a friend. Click here. Bookmark this page to your favorites.
  privacy | license | disclaimer | COPYRIGHT © 1998 - 2012 pFRONT.com