OttomanCoins Posted December 10, 2006 Posted December 10, 2006 Hi, I dont know if this is the right place for my question but if anybody can help me ? 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 ? Thank you www.osmanliparalari.com Quote
TCH-Andy Posted December 10, 2006 Posted December 10, 2006 Welcome to the forums OttomanCoins 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. 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. Quote
OttomanCoins Posted December 10, 2006 Author Posted December 10, 2006 (edited) Thank you for warm welcomes Do you know any good web log analyzers ? Edited December 10, 2006 by OttomanCoins Quote
TCH-Don Posted December 10, 2006 Posted December 10, 2006 Welcome to the forums OttomanCoins Have you looked at hotscripts.com for a Click Tracker script? Quote
TCH-Thomas Posted December 10, 2006 Posted December 10, 2006 Welcome to the forum, OttomanCoins. Quote
Steve Scrimpshire Posted December 10, 2006 Posted December 10, 2006 (edited) 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). 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: ><?php $counter_file = "counter6.txt"; $ipaddresses = "ipaddresses6"; $script = "Fibonacci"; $submitted_email="myaddress@myisp.com"; $to_email="otheremail@myisp.com"; if (getenv("HTTP_CLIENT_IP")) { $ip = getenv("HTTP_CLIENT_IP"); } else if (getenv("HTTP_X_FORWARDED_FOR")) { $ip = getenv("HTTP_X_FORWARDED_FOR"); } else if(getenv("REMOTE_ADDR")) { $ip = getenv("REMOTE_ADDR"); } else { $ip = "UNKNOWN"; } $isthere = "0"; $somecontent = "$ip\n"; $filestuff = file("$ipaddresses"); foreach ($filestuff as $line_num => $line) { $line = trim($line); $ip = trim($ip); if ($line === $ip) { $isthere = 1; } } if ($isthere == "0"){ if (is_writable($ipaddresses)) { if (!$handle = fopen($ipaddresses, 'a')) { echo "Cannot open file ($ipaddresses)"; exit; } if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } } // Open the file for reading if (!($fp = fopen($counter_file, "r"))) die ("Cannot Open Counter file: $counter_file."); // Read 20 characters from the file $counter = (int) fread($fp, 20); // Close the file fclose($fp); // Increment the counter $counter++; // Open the file, in write mode $fp = fopen($counter_file, "w"); // Write the new value of counter to the file. fwrite($fp, $counter); // Close the text file. fclose($fp); $hostname = gethostbyaddr($ip); 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"); } //ini_restore(sendmail_from); Header ("Content-type: image/png"); Header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); Header("Expires: Thu, 19 Nov 1981 08:52:00 GMT"); Header("Pragma: no-cache"); $img = @ImageCreatefromPNG("blank.png"); ImagePNG($img); ImageDestroy($img); ?> 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. Edited December 10, 2006 by Steve Scrimpshire Quote
OttomanCoins Posted December 10, 2006 Author Posted December 10, 2006 I am now trying weblogexpert. I think this will do the job. If not, I will ask more help from you. Thank you for all your help. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.