Tracking Clicks On Landing Pages
Tuesday, May 27th, 2008One of the essential things to do when driving traffic to a landing page and beyond (to your affiliate offer) is to track the clicks on the links. I also like to make the link appear to be still on my site and cloak the destination.
Like other marketers, I like to use “go” in the URL so the visitor is expecting to go somewhere but they can’t simply type in the URL of the offer page, they will have to click to find it out.
Today I put together a simple “splash page” which is a minimalist advert page designed to display rapidly and generate clicks to a lead capture page. I am trying this out on a traffic exchange. I had minimal success with traffic exchanges before but they are frequented by people looking to make money online. So I feel there must be a way to channel them away from the scams and towards standard, proven affiliate marketing training.
On this page, I used a vertical banner to the left of the Ad copy with the link to the affiliate training offer from clicks on the banner. I used a link of the form: mysite.com/affiliate-offer/?go=proof If people change this URL, they won’t go anywhere except back to my site.
To redirect them to the affiliate offer, I append some PHP code to the page. The page is index.php in a sub directory of my site.
Here is the redirection code:
if (isset($_GET[‘go’])){
//Track clicks on the links and redirect the browser
//Click log
$fn = "log/".date("d-m-y").".txt";
$fp = fopen($fn, "a+"); //Create the file or open it
//Get visitor data
$ip = getenv("REMOTE_ADDR");
$agent = getenv("HTTP_USER_AGENT");
$ref = getenv("HTTP_REFERER");
$t = date("H:i");
fwrite($fp, "$ip\t$t\t$ref\t$agent\n");
fclose($fp);
$loc = "Location: AFFILIATE_URL";
header($loc); /* Redirect browser */
/* Make sure that code below does not get executed when we redirect. */
exit;
}
?>
Replace AFFILIATE_URL with your affiliate link.
This code also logs all the clicks with a time stamp and other data such as IP address and user agent. So you can tell genuine people from robots.
In your subdirectory you need to create a “log” directory and CHMOD the directory permissions to 777 (with FTP software such as FileZilla). Then you can browse the log files that are saved by the script.
How the script works:
when a visitor clicks on the link (link/?go=whatever), the page is re-loaded but the GET variable “go” now has a value, so the script is triggered.
The visitors data is captured and stored to the log file, then they are re-directed to the offer page.
This is not the only way to do this but one I like to use for simple tracking purposes not involving 3rd-party services.


