Search Engine Optimization Techniques | Web Site Optimization Tools | Online Test Engine | Our Services | Technology and Help Resources
Using Perl:
"Perl has been hailed as the single most important tool for expanding websites quickly and for minimizing development times".
Perl - Practical Extraction and Report Language, introduced in 1987 by Larry Wall, is probably the single most important reason for the explosive growth of the Internet. This free, fast and powerful language has incorporated some of the best features of several languages: C, awk, sed, and BASIC. What has started as a System administration tool has become the "glue language of the Net", owing to its popularity and sustained growth.
Almost the default language of choice for the Common Gateway Interface (CGI), Perl drives most of the successful dynamic websites. Now that we have laid down the preliminary introduction for Perl, we will explore a way of tracking our WebPages and even some of email campaigns we have labored to create. Why do we need tracking ? Equally, our method should not be so intrusive (like opening Pop-up/Pop-behind windows to fill some questionnaire) as to deter our visitors. For the technically savvy readers, extracting such data from the server's raw access logs would spring to mind. But as in all things in life, this method is complicated and may not be practical for all. There is an easy way to track down the user information with little effort. Simple Log Script: #!/usr/bin/perl my $envy=$ENV{'QUERY_STRING'}; my $file="path/log_file"; ($sec,$min,$hour,$mday,$mon,$year,$wday)=(localtime(time))[0,1,2,3,4,5,6]; $time= sprintf("%02d:%02d:%02d",$hour,$min,$sec); $year +=1900; $mon +=1; $dayo ="$mday/$mon/$year:-$hour:$min"; open( LOG, ">>$file" ); print LOG "$dayo\|$ENV{ 'REMOTE_ADDR' }\|$ENV{'HTTP_USER_AGENT'}\|$envy\n"; close LOG; exit(0);
Our script above simply writes the date/ time of the request, our visitor's IP address, our visitor's Browser type and a little nice bit of customizable information at the end of our log file. The customizable bit of information is passed on to the Perl script when our target pages invoke this script.
If you want to see how you can retrieve the logged information from the server, check this complete script.
//adds the title of the Page and the referrer page var title=document.title; var ref=document.referrer; document.write('< img WIDTH=1 HEIGHT=1 border=0 '+ 'src="http://www.bestnetcraft.com/cgi-bin/log.pl?"'+title+'-'+ref+ '>'); < noscript > < img WIDTH=1 HEIGHT=1 border=0 src="http://www.bestnetcraft.com/cgi-bin/log.pl?Page_Title"> < /noscript > The above script adds the page title and the referrer page to the log file. You can add other information too - Visitors' screen resolution, color depth and anything else that can be accessed by the client-side JavaScript.
Scene 1 : you have an HTML page describing in some detail about your leather executive briefcase. You have promoted this merchandise in several regional websites amongst others. You wish to know which website sends you the maximum number of potential customers. Scene 2 : You have unleashed an email campaign in HTML format so that your carefully created images about your various products and assiduously crafted copy to convince your target audience to induce them to buy. You want to make sure of the following:
Scene 3 : You have a hosting account with no access to the raw server logs. Although these days most of the Hosting companies throw in access to the log files, there are some hosting accounts, which refuse access to the access_logs. Conclusion: Perl, the ubiquitous glue language of the Web, can simplify your daily chores, enhance the user experience and achieve all these and more with little development time. Our example above of about a few lines of pithy code can bring the visitors closer to you with little effort. |