Here’s a Quick Way of Cloaking Affiliate Links

affiliate link cloaking“You need to cloak your affiliate links” – this is one of the first things that every affiliate marketer will tell you when it comes to technical aspects of the business, but most of the time they won’t tell you how to actually do it. So that’s what I’m here for!

Affiliate link cloaking is rather simple, and after you finish reading this post you will know exactly how to do it. How to hide your links from hostile looks of the competition or dishonest internet surfers. And it doesn’t matter whether you’re using WordPress or your own custom solution – I cover both.

This post consist of two parts. The text which you are reading right now. And a PHP source file doing all the affiliate link cloaking.

Download the source file here (The file is password-protected. You can find the password in my RSS feed, all you have to do is subscribe.)

Let’s take it from the top. In order to modify the script that I just gave you, you will need a simple text processor, e.g. notepad (or notepad++ which I prefer). I would advise you not to use Microsoft Word or anything like that, the simpler text processor the better.

If you already have a tool like this, then it’s time to start the work.

After opening the script in your text processor you will see this:

The rest of the file does not require modification. So these several lines are all you have to deal with.

Ok so this is what you do. In the line that contains:

$myhomepage = ‘http://google.com’;

You have to replace “http://google.com” with your website URL (important! This should be the URL of your website not the affiliate link; you got to have your own website for this to work, if you don’t, I can’t help you). What’s important is that you have to type in the URL between the apostrophes and remember about the “http://” prefix. After you’ve done that, the line will look something like this:

$myhomepage = ‘http://yourwebsite.com’;

Half the job done!

The only thing you have to do now is input your affiliate link and give it a name. In order to do it you need to modify these lines:

$name1 = ”;

$dest1 = ”;

For example if you want to create a redirection (i.e. hide a link) to Yahoo then these lines could look like this:

$name1 = ‘yahoo’;

$dest1 = ‘http://yahoo.com’;

The name “yahoo” is, of course, just an example. You can use whatever name you like. (Both the name and the destination URL have to be placed between the apostrophes.)

Cloaking more than one link is also possible. To do so you just have to fill out the lines:

$name2 = ”;

$dest2 = ”;

$name3 = ”;

$dest3 = ”;

$name4 = ”;

$dest4 = ”;

(Both the name and the destination URL have to be unique, which means that you can’t use the same name more than once.)

As you have probably guessed by now, redirecting to Yahoo doesn’t make much sense, so you’re probably going to cloak links pointing to Clickbank or Commission Junction. Here is one more proposition: with very little work you can add a function of clicks counting.

The easiest way of doing this is by using a service well known in the twittersphere – bit.ly. Here’s what you have to do. You got to have an account on bit.ly. You can create one for free, so if you don’t have it already, then this is the right moment to get one.

You have an account on bit.ly? Great! The only thing you have to do now is shorten your affiliate link with it, and input it to the script, for example like this:

$name1 = ‘yahoo’;

$dest1 = ‘http://bit.ly/nIO/’;

That’s it for the affiliate link cloaking!

This way you’ve cloaked your affiliate link and got the click counter. The only thing you have to do now is upload the script to your web server (probably to your domain’s main directory) using FTP. If you don’t know what the FTP is, and how to use it, then either google it or ask your webmaster to do this for you, but I recommend the former, because uploading a file to the server is a really simple thing to do. It won’t take you more than a minute and you will probably use the FTP-thing more than once in the future.  So don’t lose your time and money by outsourcing it to someone else.

How to use the script?

Now your cloaked link looks something like this:

http://yourwebsite.com/go.php?x=yahoo

where “yahoo” is the name which you’ve chosen yourself.

Now, every time when you want to redirect someone to your affiliate link, you can use the cloaked version of the link (the one above). If in addition you are using bit.ly, then you will have some extra data about the number of clicks.

What’s the purpose of all this play?

When it comes to the cloaking itself, I think that the whole thing is clear, so a different question arises here. Why not just use bit.ly alone and ignore the hustle with the script?

Using such script gives you some benefits

Firstly, at first glance the link points to some page within your domain, so Google doesn’t treat it like a regular affiliate link.

Secondly, bit.ly can be easily “unshortened”, e.g. by untiny.me. When you’re using another script this problem does not affect you, because your bit.ly link is not visible anywhere on the website.

Thirdly, users tend to be skeptical when someone uses bit.ly links on their websites. It’s just suspicious, and that’s because everyone knows what bit.ly is for – hiding the destination of the link (when used outside of twitter). So if someone uses it on his website, then it means that he wants to hide something from us. Using your own domain in the link is far less suspicious, and more likely that someone will click it.

WordPress users are not left behind

If you are using WordPress, then the script I provide here is probably not the best solution for you. Instead you should install a plugin called “Pretty Link“, which really does a great job at affiliate link cloaking. The plugin is easy to use and it has the option of counting the clicks built in it, so you don’t have to use bit.ly.  (Should I explain how to use the plugin?)

This is pretty much it. I wanted to write something as the summary but there’s really not much I can say. As you can see the whole process of cloaking affiliate links is rather simple, and if you’re using WordPress, then it’s even more than simple.

So have a good luck in your affiliate business, and see you in the comments.

Last updated on