Return To The uShop Reference Site
1. Cookies and Affiliate Tracking
uShop's affiliate tracking system works by having any links to your store from
affiliates set an "affiliate" cookie. This "affiliate" cookie will get
set to a value based on each affiliate's unique ID (the unique ID that was
assigned to the affiliate when he/she signed up to become an affiliate). The
"affiliate" cookie will last on the visitor's browser for 7 days.... and
therefore, if the visitor puchases anything from your store within those
7 days, then the referring affiliate will get the proper credit for the sale.
2. Standard Affiliate Linking
As specified in the uShopTM User's Guide, the standard way to have
an affiliate link to your store, is to have the affiliate link to the URL of
the "ushop.pl" script on your public server, such as:
http://www.yourdomain.com/cgi-bin/ushop.pl?id=AID&url=YOURURL
Note that at the end of the "ushop.pl" script URL, there are two special parameters
that are also passed - the id parameter and the
url parameter. The id
is used to specify the affiliate's ID and the url specifies
the URL of your website. For example, this following link will set the affiliate cookie
to "TEST" and then link you to the main page of our www.uburst.com website:
http://www.uburst.com/cgi-bin/ushop/ushop.pl?id=TEST&url=http://www.uburst.com/
3. Possible Problem With The Standard Affiliate Linking Process
The standard way of linking affiliates to your store (as described in the previous
section) will only work if you have your own secure certificate for your site. That
is, you must be able to refer to the your "ushop.pl" script via the URL's:
http://www.yourdomain.com/cgi-bin/ushop.pl?id=AID&url=YOURURL
and
https://www.yourdomain.com/cgi-bin/ushop.pl?id=AID&url=YOURURL
Note that the www.yourdomain.com domain name is identical
for both the public and secure URL. The reason this must be the same is because the
affiliate cookie that gets set by linking to your public URL must be accessible during
the secure order process... and as part of the standard cookie protocol, cookies can
only be read by the same domain that set the cookie. That is, if the domain of your
public URL is not the same as the domain of your secure URL, then the secure uShop
CGI script will not have permission to read the affiliate cookie.
4. Solution To The Affiliate Linking Problem
To get around the problem described in the previous section, we have provided the
uShopTM cookies.pl script which will handle setting and reading
the cookies on your public server....before customers are even transferred to your
secure server. That is, the cookies.pl script will allow you to successfully read/set
affiliate cookies.... even if your public and secure domains are different.
5. Installation Of The uShopTM cookies.pl Script
The cookies.pl script is actually a very basic Perl script and should install
very easily on your server. To install the cookies.pl script:
- Specify your server's "path to perl" as the very first line of the script.
- Transfer the script to your public server in ASCII or TEXT mode.
- Give the script read/execute permissions (chmod 755).
6. Linking To The uShopTM cookies.pl Script
Linking to the uShopTM cookies.pl script is very similar to linking
to the "ushop.pl" script:
http://www.yourdomain.com/cgi-bin/cookies.pl?id=AID&url=YOURURL
Note again that at the end of the "cookies.pl" script URL, there are two special
parameters that are also passed - the id parameter and the
url parameter. The id
is used to specify the affiliate's ID and the url specifies
the URL of your website. For example, this following link will set the affiliate cookie
to "TEST" and then link you to the main page of our www.uburst.com website:
http://www.uburst.com/cgi-bin/ushop/cookies.pl?id=TEST&url=http://www.uburst.com/
Note that this is identical to how you would link to the ushop.pl script on your
public server - except you are linking to the public URL of your cookies.pl script instead.
7. No Cookies Being Set?
On the rare occasion, some servers may prevent cookies from being set when a URL
redirection is also being performed. That is, if you find that the URL:
http://www.yourdomain.com/cgi-bin/cookies.pl?id=AID&url=YOURURL
... is not setting the affiliate cookie before redirecting the visitor to the
specified url, you may need to omit the
url portion of that link and instead use an IMG SRC
to call the cookies.pl script. For example, the following 2 lines of HTML could
be placed on the affiliate's website to set the affiliate cookie and then link visitors
to your store without the URL redirection:
<IMG SRC="http://www.yourdomain.com/cgi-bin/ushop/cookies.pl?id=TEST" BORDER=0 WIDTH=1 HEIGHT=1>
<A HREF="http://www.yourdomain.com">http://www.yourdomain.com</A>
Note that the second line used to link to your website can actually be any type of HTML
link - such banner image as in the example below:
<IMG SRC="http://www.yourdomain.com/cgi-bin/ushop/cookies.pl?id=TEST" BORDER=0 WIDTH=1 HEIGHT=1>
<A HREF="http://www.yourdomain.com"><IMG SRC="http://www.yourdomain.com/images/yourbanner.gif"></A>
8. One Final Note
One last thing to point out is that in regard to setting the "affiliate" cookie,
the above discussion also applies to setting the "coupon" cookie. That is, as specified
in the User's Guide, customers may be linked to your site via "coupon" links, such as:
http://www.yourdomain.com/cgi-bin/ushop.pl?coupon=COUPONID&url=YOURURL
... Where a coupon parameter is specified instead of -
or in addition to - the affiliate id parameter. Coupon
links work the same way as affiliate links in that they must set a "coupon" cookie,
therefore the above "cookie.pl" solutions also apply to "coupon" cookies.