Link Cloaking

Last Update: July 02, 2012
I recently started using link cloaking on my sites to prevent link hijacking and stripping. I was about to sign on with a new advertiser. I am glad I thoroughly read their terms of service, which prohibits link cloaking and masking. I can still use their service as long as I use the links provided by their company and keep them transparent.

What is Link Cloaking?
Instead of having your affiliate link looking like this:

http://affiliate.buy.com/fs-bin/click?id=gdquApZfPlk&subid=&offerid=252787.1&type=10&tmpid=6933&RD_PARM1=http://www.buy.com/prod/jack-lalanne-power-juicer-pro-stainless-steel-electric-juicer/223407362.html

You can have it look like:
http://yoursite.com/recommends/JackLaLannePowerJuicer

The second link is a php file on my page that automatically directs potential customers to the first, really long and confusing link. Since I have cloaked links, I have had a higher click through rate.

How do I cloak a link?
First, you have to get your affiliate link. (remember to make sure that the company you are affiliated with doesn't mind if you cloak it)

Second, create a php file using a program such as Notepad ++

Third use this code (switch the [ with < and ] with >) code: [?php
header( 'location:youraffiliatelink.com' ) ;
?]
Fourth, name the php file "index" and place it in a folder. If I want my link to http://yoursite.com/recommends/JackLaLannePowerJuicer, then the name of my folder will be JackLaLannePowerJuicer

Fifth, using a program like filezilla, log into your site using FTP. Create a folder called recommends inside the folder httpdocs. Transfer the folder from step 4 into the recommends folder. Your index file will transfer with it.

Sixth, link the text or picture as usual using your new cloaked link.

Seventh, test your link to make sure it works. I have noticed that sometimes I accidentally copied only part of my affiliate link into the index.php or accidentally copied my link while erasing 'location: in the php code. Either way, it won't work if there is a tiny mistake.
Join the Discussion
Write something…
Recent messages
Beckywahm Premium
I tried to use My Linker, but some of the code in my affiliate links includes symbols not accepted by mylinker. The link tracking does sound useful , especially for those companies that do not offer that tool or it is not in real time. Thank you :)
klrrider Premium
Don't think it will hurt load time... the thing that really slow my blogs down is video. A necessary evil if you want to entertain visitors.

You can use the plugin to build short links to any affiliate link even if it has nothing to do with your blog... kinda like mylinker here at WA.

Here is an example and it has nothing to do with the site it resides on...

http://klrrider.com/MyPCbackup

I like the fact that I can keep track of hits.
klrrider Premium
If you are using a WordPress blog anywhere install the "Pretty Link" plugin and you can make all the cloaked/shortened links you want... and even track their ctr!
Beckywahm Premium
That's good to know. I've thought about adding a plugin to my site for that reason, but was told my site was already taking a long time to load. I will have to check it out, especially if it is even faster than what I am doing. Thanks!
Top