Text Link Ads

Tuesday, June 17, 2008

Web Site Coding Tip: Use a PHP "redirect" for affiliate links.

One thing that we came up with after years of being a poker affiliate was the concept of "hiding" your affiliate codes from people when they click on affiliate links. The human nature reason for this is there are a number of people that will avoid clicking on something if they think it will make YOU money (even though it costs them nothing). Many people will look at the address of the link (which will often include an affiliate id, like www.fictitiouspokersite.com/?affiliateid=90210) and just type www.fictitiouspokersite.com in their browser bar to avoid signing up with your affiliate information.

Why? Why ask why, but trust me it's the truth. Maybe you yourself have done this.

When Internet Explorer 6.0 was out you could write some quick javascript to rewrite the status bar so your visitors wouldn't see the affiliate code, but in IE7.0 and in the new version of Firefox you can no longer do that (to help avoid phishing attacks).

The solution to this is to create a simple php file on your web site which will redirect people to your various affiliate sites. The links end up looking something like this:


which is what your visitor will see on their status bar. Notice two things: One, your actual affiliate code is hidden from the visitor--they have no idea if you are even using one and Two, you are not even revealing the site address of the place you are sending them. In some cases it may be obvious but it makes for extra work if your visitor wants to Google the site and then go there to avoid clicking on your link.

So how do you do it? Here's the sample code:

File goto.php

$webroot = $_SERVER['DOCUMENT_ROOT'];
$s_target = $_GET['target'];

switch ($s_target)
case "GoDaddy":
header("location: http://www.tkqlhce.com/click-3061995-10378494");
case "UltimateBet":
header("location: http://www.ultimatebet.com?ubAffilID=72855");

You can expand this file with more header(); break; pairs for all of your affiliate codes. Then just change your links from http://www.ultimatebet.com?ubAffilID=72855
to http://www.yoursite.com/goto.php?target=UltimateBet

This technique also has the added advantage that all your affiliate IDs become centralized in one file so if (when!) you need to change your affiliate code you can do it one time in one location instead of hunting through perhaps hundreds of pages on your website and changing it in each location.

Try it, you'll like it!