Build Your Own Web Measurement Application: Reporting

Now that the application is built and you’re collecting and analyzing data, the time has come to think about next steps. We make a handful of suggestions about other things this application could do to improve data collection, performance, or reliability.

As we’ve gone through the book, we’ve built a program to collect data from visitors to your web site, and a program to analyze the data and produce some basic statistics. In this final hack, we’re going to remind you how to run the application and discuss ways in which it could be extended.

You can get both programs from:

http://www.webanalyticsdemystified.com/byo

You will also find a sample logfile there to allow you to run the second program without waiting to collect any data of your own first.

Running the Application

Remember that this application depends on a small piece of JavaScript [Hack #12] code that is embedded in each page you want tracked. All you need to do is add the following code near the top of the <BODY> element of each of your web pages:

	<script>
	document.write('<img src="/cgi-bin/readtag.pl?url=
		'+escape(document.location)+'&amp;ref='+escape(document.referrer)+'">'); 
    </script>

To process the code, you’ll use the readlog.pl Perl script that we developed throughout most of the book. To execute this program from the command line, assuming that page.log is in the same directory as readlog.pl, all you need to do (assuming you’ve already installed the GeoIP modules ...

Get Web Site Measurement Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.