Affiliate
Tracking Alternative
CGI
Scripts
Please
note - we have not tried this and cannot be responsible if it doesn't work for
you as you may be expecting. We are showing it for your information. If you do
use it and find it works, please let us know.
CGI Script - AFFILIATES' TRACKING MADE EASY!
By Patrick Tan patrick@aloha-city.com
Affiliate programs will set the wave of the future.
According to industry sources, sales concluded by
affiliates will account for 24 per cent of $37.5 billion of online consumer transactions by 2002.
If you are operating a small online business, you should seriously consider setting up an affiliate
program to give your business a much-needed push. The reason is pretty straightforward. An affiliate
can tap on his immediate network of friends, colleagues and associates to market your
products or services. These people will be more receptive to what their acquaintance has to say about your company,
products or services than if you were to market to them directly.
There are several companies on the Net that offer professional services in affiliates recruitment,
tracking and management. Their fees may be quite substantial especially when you are running a small
home-based business on a shoestring budget. In this case, you may consider setting
up a simple dealer tracking system yourself using CGI programming.
To understand how this script works, assume that you have a website containing only two pages - sales.html
and order.html. Follow the steps below accordingly to set up your website:
Create the two html pages using any standard web publishing software or HTML Editor.
Duplicate the two pages and rename them as sales.txt and order.txt accordingly.
Open sales.txt and replace all hyperlinks with .cgi?abcdefvwxyz. In our example, replace the only
link - order.html - with order.cgi?abcdefvwxyz.
Open order.txt and insert the following code:
<input type=hidden name="code"
value="abcdefvwxyz">
in between the order form:
<form method=POST action="http://www.yoursite.com/cgi-bin/form.pl">
<input type=hidden name="code" value="abcdefvwxyz">
</form>
Use a text editor to create sales.cgi and order.cgi files with the following script. (Note: do not use a
word processor such as Notepad to create the cgi files. Any formatting codes embedded in the script will
render it inactive.) For order.cgi, replace the TEMPLATE,"<sales.txt" with TEMPLATE,"<order.txt".
-------begin script----
#! /usr/bin/perl
open(TEMPLATE, "<sales.txt");
@lines=<TEMPLATE>;
close (TEMPLATE);
$buffer=$ENV{'QUERY_STRING'};
print "Content-type: text/html\n\n";
foreach $temp (@lines)
{
$temp =~ s/abcdefvwxyz/$buffer/g;
print $temp;
}
exit;
--------end script-----
Upload all the six files - sales.cgi, sales.html, sales.txt, order.cgi. order.html and order.txt to
your server.
Your simple dealer tracking system is now ready. When your affiliate sends a visitor to your website with a
hyperlink that reads like http://www.yoursite.com/sales.cgi?RPUS20SG011, sales.cgi will call up sales.txt and virtually replace
order.cgi?abcdefvwxyz with order.cgi?RPUS20SG011 as seen in the browser window.
When the visitor clicks on the link to the order page, the affiliate ID - RPUS20SG011 - will be captured by
the "code" field in the order form. This data will ensure that proper commissions are credited to the
affiliate's account should a sale transaction go through.
Note: There are no physical changes made to the original text of sales.txt. It still contains the
link as order.cgi?abcdefvwxyz. The cgi script in sales.cgi just causes the browser to treat
order.cgi?abcdefvwxyz as order.cgi?RPUS20SG011.
You can use the above methodology to duplicate 100s of pages in your website. The system will transfer
an affiliate's ID from one page to another and credit his account with the proper sales commissions. This
is how Fort Street Mall's affiliate program works.
To have a better understanding of how we track our
affiliates' sales, go to http://www.aloha-city.com/affiliate/