So I’ve been thinking of tracking my ads one of the biggest ads you should use is banners. But how do you know how many times there actually being shown? Well that’s easy, you simply make a tracking page that produces your image and writes to the database the results.
Here is a simple write up on how to do it with mod rewrite that produces 2 variables, the affiliate name and the campaign. The only thing I won’t cover is mysql retrieval, entry or mod rewrite. The banner database needs a minimum of id, name, url, and type. The script takes in from the mod rewrite 2 variables, one to pull the banner type and url for this I use the name to pull it. The then the name and campaign get written to my tracking table for review.
// Copywrite (C) 2010 Steven Whitelock
// http://g1eagle.com
// If you uses this script you must keep the copyright must remain intact.
// This tells the browser its an image
header(‘content-type: image/jpeg’);
//Next two lines pull information from the url thats using mode rewrite
$Affiliate = $_GET ['req'];
$campaign = $_GET ['req2'];
// Tracking information
// The next five lines that deal with tracking, you would need to decide for yourself whats important,
// at minimum you want the ip address, the php command is $_SERVER['REMOTE_ADDR'] to retrieve that.
$ip = $_SERVER['REMOTE_ADDR'];
$hoster = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$remote_host = $_SERVER['REMOTE_HOST'];
$agent= $_SERVER['HTTP_USER_AGENT'];
$http_referer = $_SERVER['HTTP_REFERER'];
//***************************************
// Enter your retrieval information, and write your tracking to your database!
//***************************************
// From my database I pull the following information $imgtype for the type of image,
// and $imgSource for the path of the image. The next section produces the image.
switch ($imgtype) {
case “gif”:
$image = imagecreatefromgif(“$imgSource”);
break;
case “png”:
$image = imagecreatefrompng(“$imgSource”);
break;
case “jpeg”:
$image = imagecreatefromjpeg(“$imgSource”);
break;
}
// This portion displays the image to the browser and clears the memory.
imagejpeg($image);
imagedestroy($image);
If you need help getting the script to work leave a comment! I do actually read every comment on my blog.
No related posts.















hey this blog is great. I’m glad I came by this blog. Maybe I can contribute in the near future.
Sorry I don’t use Yahoo.
Pretty cool … hopefully, I’ll be able to catch up to you.
I also have some “undercover” digital recording devices … along with the digital recorder, you could also use an Olympus TP7 from Radio Shack … that way, if for some reason you need to record a telephone conversation, you can do that also. I also use this earbug as the microphone when I am undercover as a PI.
cheers – AnnClaire
I’m sure you can catch up to me.
I simply try to write on a weekly basis, with one post a week coming out on Monday. I have the next one done. I do always try to write them in advance.