More Detailed Statistics Needed

liunx

Guest
Hi, I dont know if this is the right place for my question but if anybody can help me ?<br /><br />I put ads of my friends' web sites into my web site (and also into the forum). If the file I put is SWF type I can easily saw from cPanel Statistic, how many times it was loaded or clicked. But I can not do the same thing for JPG or GIF files. Is there a way to do this ? <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wallbash.gif" style="vertical-align:middle" emoid=":wallbash:" border="0" alt="wallbash.gif" /> <br /><br />Thank you<br /><br />www.osmanliparalari.com<!--content-->
Welcome to the forums OttomanCoins <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> <br /><br />Basically you will need to either use a script (which is effectively what is in the swf files) or you will need to analyze your log files. <br /><br />Other than that, I'm not aware of a way to automatically get the information from a straight image file such as a gif or jpg.<!--content-->
Welcome to the forums OttomanCoins <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
Thank you for warm welcomes <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/tchrocks!.gif" style="vertical-align:middle" emoid=":tchrocks!:" border="0" alt="tchrocks!.gif" /> <br /><br />Do you know any good web log analyzers ?<!--content-->
Welcome to the forums OttomanCoins <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> <br />Have you looked at hotscripts.com for a Click Tracker script?<!--content-->
<a href="http://www.weblogexpert.com/index.htm" target="_blank">WebLog Expert</a><!--content-->
Welcome to the forum, OttomanCoins. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
Here's an example of a script I use to keep track of page reads. It uses php-gd, a 1x1 pixel transparent pixel and an alteration to my .htaccess file so I can name the file whatever.png and it still executes as a php script. The only output of the script is the blank.png and the rest is just commands that are executed in the background every time the page loads with the blank.png in it. In your case, you could have it output the ad image and for the link, you could redirect it to another php page briefly that logs the click then redirects them to the ad's site. That way you would have a log of views and a log of clicks. My particular script just creates and updates a counter file and a file that keeps track of ip addresses so I'm not counting the same ip address twice (in case the viewer leaves the page and comes back). <br />I could easily update this script for you to do what you need if you like it. Here's my script as I use it:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><?php<br /><br />$counter_file = "counter6.txt";<br />$ipaddresses = "ipaddresses6";<br />$script = "Fibonacci";<br />$submitted_email="[email protected]";<br />$to_email="[email protected]";<br /><br />if (getenv("HTTP_CLIENT_IP")) {<br />    $ip = getenv("HTTP_CLIENT_IP");<br />    } <br />    else if (getenv("HTTP_X_FORWARDED_FOR")) {<br />             $ip = getenv("HTTP_X_FORWARDED_FOR");<br />             } <br />    else if(getenv("REMOTE_ADDR")) {<br />            $ip = getenv("REMOTE_ADDR");<br />            } <br />    else {<br />          $ip = "UNKNOWN";<br />         }<br /><br />$isthere = "0";<br />$somecontent = "$ip\n";<br /><br />$filestuff = file("$ipaddresses");<br /><br />foreach ($filestuff as $line_num => $line) {<br />  $line = trim($line);<br />  $ip = trim($ip); <br />  if ($line === $ip)<br />      {<br />       $isthere = 1;<br />      }<br />   }<br /><br />if ($isthere == "0"){<br />    if (is_writable($ipaddresses)) {<br />        if (!$handle = fopen($ipaddresses, 'a')) {<br />            echo "Cannot open file ($ipaddresses)";<br />            exit;<br />            }<br />        if (fwrite($handle, $somecontent) === FALSE) {<br />            echo "Cannot write to file ($filename)";<br />            exit;<br />            }<br />        }<br />    <br />    // Open the file for reading<br />    if (!($fp = fopen($counter_file, "r"))) die ("Cannot Open Counter file: $counter_file.");<br /><br />    // Read 20 characters from the file<br />    $counter = (int) fread($fp, 20);<br /><br />    // Close the file<br />    fclose($fp);<br /><br />    // Increment the counter<br />    $counter++;<br /><br />    // Open the file, in write mode<br />    $fp = fopen($counter_file, "w");<br /><br />    // Write the new value of counter to the file.<br />    fwrite($fp, $counter);<br /><br />    // Close the text file.<br />    fclose($fp);<br />    $hostname = gethostbyaddr($ip);<br />    <br />    mail("$to_email", "Someone viewed $script", "IP address: $ip\nHostname: $hostname\nIt has now been viewed $counter times. Cool!\n","From: $submitted_email") or die("error");<br />     }<br />    <br />   <br />//ini_restore(sendmail_from);<br /><br />Header ("Content-type: image/png");<br />Header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");<br />Header("Expires: Thu, 19 Nov 1981 08:52:00 GMT");<br />Header("Pragma: no-cache");<br /><br />$img = @ImageCreatefromPNG("blank.png");<br />ImagePNG($img);<br /><br />ImageDestroy($img);<br /><br />?><!--c2--></div><!--ec2--><br /><br />Of course, if you have a lot of banners/ads, you may want to keep track of the statistics in a database rather than a flat file like I do here.<!--content-->
I am now trying weblogexpert. I think this will do the job. If not, I will ask more help from you.<br /><br />Thank you for all your help. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/clapping.gif" style="vertical-align:middle" emoid=":clapping:" border="0" alt="clapping.gif" /><!--content-->
 
Top