BannerSpy Where are they clicking?

Click on any banner to view a graph showing the 'hot-spots' where visitors have clicked the most. You will also be able to send me your own banner to display in the rotation.

#!/usr/local/bin/perl # ####################### # show_banners.cgi # ##################################################################### # # This is a part of the banner study application, this script looks # through the text file with all banner views, and decides which one # to display based on number of views. # ##################################################################### use CGI; use CGI::Carp qw(fatalsToBrowser); ##################### # CONFIGURATION ##################### require "config.pl"; # configuration file $templateFile = "templates/show_banners.htmlf"; ####### # MAIN ####### print "Content-type: text/html\n\n"; #Read the views data file open (GATE, "$viewsFile") or die ("Could not open views file\n"); @ViewsData = ; close (GATE); foreach $pair(@ViewsData) { #Convert views data to hash chomp($pair); ($ThisBanner,$ThisViews) = split(/\|/,$pair); $ViewsHash{$ThisBanner} = $ThisViews; } @Banner = sort { $ViewsHash{$a} <=> $ViewsHash{$b} } keys %ViewsHash; #And we sort by views #We are going to ramdomize the order a little bit srand($$|time); for ($count = 0; $count<5; $count++){ $RandomA = int(rand(4)); $RandomB = int(rand(4)); $temp = $Banner[$RandomA]; $Banner[$RandomA] = $Banner[$RandomB]; $Banner[$RandomB] = $temp; } #Display the HTML for the 4 banners $Banner1 = $Banner[0]; $Banner2 = $Banner[1]; $Banner3 = $Banner[2]; $Banner4 = $Banner[3]; print &Template ($templateFile); # Now we add one to the count for those banners $ViewsHash{$Banner[0]} += 1; $ViewsHash{$Banner[1]} += 1; $ViewsHash{$Banner[2]} += 1; $ViewsHash{$Banner[3]} += 1; # And we print back out to the views file $buffer = ''; foreach $key (keys %ViewsHash){ $buffer .= $key."|".$ViewsHash{$key}."\n"; } open (GATE, ">$viewsFile") or die ("Could not open views file\n"); print GATE "$buffer"; close(GATE); ################################################################# # This will read the template file and fill in the variables from the script ################################################################# sub Template { local(*FILE); # filehandle local($file); # file path local($HTML); # HTML data $file = $_[0] || die "Template : No template file specified\n"; open(FILE, "<$file") || die "Template : Couldn't open $file : $!\n"; while () { $HTML .= $_; } close(FILE); $HTML =~ s/\$(\w+)/${$1}/g; return $HTML; }
Warning

Important: These banners are not real ads, and they will not take you out of this site. I ask that you click on one of them before showing you the graphs so that we will have some statistics to display.