How to Create an Affiliate Redirect Script Easily Using Javascript Code

This is an easy guide to create your own “pretty affiliate URLs” using a simple affiliate redirect script in Javascript.
First of all, let’s take a look at the desired effect. For this example, I’m going to use a nice Legal Form Generator affiliate URL I often share:

http://www.nitroshoppingcart.com/app/?af=1268050

Notice the URL is complex. It’s hard to say it in an audio recording, or even for a prospect to remember it.
Rather than give out this complicated URL, I simply share a “pretty affiliate URL” that looks like this:

http://jimyaghi.com/recommends/legal

Tidy, isn’t it? You can create your own on your domain using the following recipe.

Requirements:

  1. A domain name (your current website domain will do)
  2. A hosting account (your website is fine for this too)
  3. FTP access to your server so you can transfer files
  4. A text editor like Microsoft Notepad or Mac TextEdit
  5. At least ONE Affiliate URL

Directions:

1. Open your text editor and copy the following Javascript code exactly to a new file:

<html><head><script type="text/javascript">
<!--
window.location = "http://www.nitroshoppingcart.com/app/?af=1268050";
//-->
</script></head>
<body></body></html>

2. Replace the demo link with your own affiliate link, making sure not to remove the double quotes in the code.
3. Save the file to your Desktop with the name ‘index.html’ (without quotes).
4. Open your FTP client (BestFtp 2000 or WinSCP is good)
5. Connect to your server’s home directory. Usually /public_html or just /html.
6. Create a new directory called ‘recommends’ (without quotes).
7. Browse to the ‘recommends’ directory
8. Create a new directory called ‘legal’ or whatever you want to refer to your affiliate program as. It doesn’t matter what you put here, as long as it’s a unique name.
9. Browse to the ‘legal’ directory.
10. Once inside, upload the index.html file on your desktop to the open directory. This copies the file index.html to http://yourdomain.com/recommends/legal/
You’re done!
Now you can test this by browsing to http://yourdomain.com/recommends/legal
Of course, if you used different directories, you would need to replace my demo URL with the path you used.
You can add as many affiliate products as you want in the same way. Just create new directories inside the ‘recommends’ directory and upload index.html files to them.
The file “index.html” is the default file accessed when someone browses to the directory you specify. Share your pretty affiliate URL with your prospects and all sales that access your pretty link from now on will be tracked to you.
Please Note: This method only works if the user has javascript enabled on their browser. Consider using the Affiliate Link PHP Redirect or Affiliate Link HTML Redirect versions instead to guarantee it works on all browsers.
~jim
P.S. for more tricks like this, check out the YaghiLabs Internet Business Academy at…

http://jimyaghi.com/ylacademy

 

Jim Yaghi

Jim Yaghi

Foremost Home Business traffic expert, Jim Yaghi is a Computer Scientist and Mathematician who used to build search engines for a living. At 16 he created a mildly popular social network and has been an online entrepreneur for over 15 years. In 2006 he rose to the #1 Affiliate rank in many Home Business programs (most notably Magnetic Sponsoring). Today he's best known for hatching the first industry-wide viral campaign to reach all major social networks, for hosting a top-10 Internet radio show for entrepreneurs, and for shattering industry sales records with his best-selling, easy-to-follow online marketing courses PPC Domination, PPC Supremacy, and Traffic KickStart.

Login

Fill your credentials below to access your YaghiLabs Learning Center account...

For the fastest way to build and grow an online business from scratch, download the... "Just Getting Started" Guide to Endless Free Leads & Traffic

Join our newsletter below, and as a gift, you’ll get this 4-page action plan to organically build an internet-based information selling business with nothing but free traffic!

“By clicking ‘Get Started I agree to receive daily emails from Jim Yaghi containing online marketing tips and advice. I accept these emails are written to help me sample and learn how YaghiLabs products & services can help me better advertise online. I also understand that I can unsubscribe at any time from the bottom of any email. I agree to this website’s Privacy Policy and Terms of Use.

While You Consider the Super Traffic Machine

Get the Online Business Quick Start, By Joining Our Wowesome Mailing List

Let us help you build a lucrative information selling or affiliate marketing business from home. We’ll send you...

Just fill the box to begin:

“By clicking ‘Join YaghiLabs’, I agree to receive daily emails from Jim Yaghi containing online marketing advice. I understand that these emails allow me to sample and learn how YaghiLabs products & services can help me advertise online. I also know that I can unsubscribe at any time from the bottom of all emails. I agree to this website’s Privacy Policy and Terms of Use”.