How to Hide Affiliate Links
Posted Under: Affiliate marketing for dummies, hide affiliate links
It is sometimes necessary to hide, or cloak, your affiliate links to stop people stealing your commission or bypassing the affiliate link and going straight to the main site.
Some people will also replace your affiliate link with their own so that they receive the commission, this is know as link hijacking.
The other advantages to hiding affiliate links are that if people see your link in a post or email, they just won’t click it just because of the affiliate connection, hiding links WILL increase your CTR (Click Through Ratio), also, as I mentioned in an earlier post ( see How To Get Top Search Engine Rankings With Article Marketing ) many/most article directories won’t accept articles that contain affiliate links.
Please note: Some article directories such as ezinearticles.com will not even allow redirects or cloaked links, in this instance you will need to send people to your own website page, free blog or lens, that has your offer on that includes your affiliate links. This is another good reason to have your own domain (see Cheap affiliate web hosting companies ).
The quickest way to hide your links is to use a company like tinyurl.com which is free to use and turns links like http://www.YourUglyAffiliateLink.com/?12345 into something like this http://tinyurl.com/35q7rl, however this is only really a quick fix and is better to be used for mailing your opt-in lists, the people who trust you, people who don’t know you can’t tell where that link is going to take them, it could be a porn site for all they know, you will get better click through rates using another method.
IMPORTANT: Some link cloaking techniques may prevent some sites from dropping tracking cookies into your visitors computer which means you may not get credit for that referral. Check all links to make sure they work correctly, if you are still unsure use something like Affiliate Cloner to be on the safe side.
Link redirection using a php script
If you have your own website you can hide your links by setting up a page redirect.
All you have to do is to just insert this one line of code into a php file:-
<?php header("location: http:// www .YourUglyAffiliateLink"); ?>
You can name your php file to anything you want, for example, great-bargains.php, so your actual link would be YourWebsite/great-bargains.php which will redirect to the site you are promoting.
Hide your affiliate links using a zero-frame code
This technique has a little more code than above, but it actually frames the site you are promoting.
Again, you will need your own website to use this technique but it’s just as easy to do.
The following code frames the site you are promoting making it look to the visitor as if they are still on your site, in other words, no matter which page they go to on the framed site they will only see your domain in the browser window.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1" />
<title>Product Title</title>
<META name="robots" content="noindex,nofollow">
</head><frameset rows="100%,*" border="0">
<frame src="http:// www .Your-Destination-Link" frameborder="0" />
<frame frameborder="0" noresize />
</frameset> document.removeEventListener('click, clickHandler, true);
</html>
How to hide your affiliate links on a web page
This script is works a little differently to the above, it actually hides your affiliate link or any other link, from a person who hovers over over a link on your actual web page.
For example, if you hover over http://www.mygiveawaysecret.com you will see http://www.mygiveawaysecret.com in the bottom lefthand side of your browser status bar.
But, if you use this little piece of extra code that I’m about to show you, you can actually fool people that they are going to the site displayed on your actual page and in their browser status bar, but take them to a totally different website!
Here is the cloaking code in action, hover over the following link and look at your browser status bar at the bottom left, everything will look normal, then click on the link and see where it takes you, don’t worry, it only takes you to another site of mine.
Here’s the link with the added code:-
forfreedom.ws
Please note: There is a similar link cloaking code like the one I’m going to give you available, however it doesn’t work in IE7, the following code does;-
<a onclick="parent.location.href='http://www.Affiliate-link'; return event.returnValue=false" href=http://www.Display-Link>Anchor Text</a>
How to hide affiliate links using htaccess
This is another very simple redirection technique by adding a line of code to your htaccess file.
redirect 301 /AnyNameYouLike http://YourAffiliateUrl
Just add the above line of code to your htaccess file, the /AnyNameYouLike is the directory or page you want to use for redirection, for example, if named it /dog-food your link would look like this http://www.yourdomain/dog-food which would redirect traffic to your affiliate link.
You don’t need to create any pages or directories using this technique, just add the redirection code to your htaccess file.
OK, there you have it, several ways to mask your affiliate links, these methods can increase your CTR and commissions, no more ugly affiliate links, by the way, it is a major pain in the butt trying to add code to a Wordpress blog, there must be a plugin somewhere to make life easier. :-) .
Neil






























Reader Comments
Useful script and info! Thanks Neil!
I tried the <a onclick method above. It shows the display link and tries to go to the display link. I am/would like to be using it on blog posts. Was there a tweak I needed to do to the template?
Not totally clueless, but still a newbie. Thanks.
Phil
Hi Phillip,
The code works just fine on this blog as in the example above, however, either you haven’t coded it exactly as above or maybe blogspot don’t allow this type of coding, the later sounds more plausible.
You don’t need to do any tweaks to the page/template to make it work, so I reckon blogspot are probably to blame I’m afraid.
Try this Phillip, put the code in exactly as above just changing your URL’s, then right click on that page and select “view source” and find the code in the text document, has blogspot changed your code?
What page is the link on that you are trying to hide? Maybe I can see what the problem is if you still have the above code on it.
Let me know how you get on.
Neil
I already tried your technique on my website http://incomeideas.net. I just used php redirection method.
But I dont want search engines to index this files. Now suppose I am promoting 25 affiliate programs, I need to create 25 such files. Can I can add no index metatag so search engines would ignore these files. Thanks for great guide. Its very informative and detailed. Cheers:)
Hi,
I’m not sure about that, I don’t see why it wouldn’t work.
Neil
PHP code don’t work. Check it out!
Warning: Cannot modify header information – headers already sent by (output started at /www/110mb.com/e/s/i/p/o/r/t/a/esiportal/htdocs/free-email.php:1) in /www/110mb.com/e/s/i/p/o/r/t/a/esiportal/htdocs/free-email.php on line 1
Hi John,
I’ve just tested the code and it works fine, make sure you have closed the gaps in the code above as I had to put them there to stop wordpress turning them into active links.
It should look like this:-
< ?php header("location: http://www.forfreedom.ws“); ?>
Let me know how you get on.
Neil
Please review your PHP code.
<?php header(“location: http://www.breakthru.com/go/g788606-pmem“); ?>
Hi John,
The code is correct but if it’s not still working it could be that 110mb.com don’t allow redirects.
You should maybe consider getting your own domain as it’s very cheap to do, if you really need to use free hosting, try weebly.com as they don’t have any advertising on their pages and you can make good looking sites very quickly.
Neil
I’m using the “a onClick” method, but I’d like it to open in a new window instead of the same, is there a way I can do that?
I tried “target=_blank”, I even tried “new.Window”, but nothing works. I tried looking it up, and all I get is javascript tutorials.
Hi Taylor,
I’ve messed around with this code in the past to try and get it to do that but I haven’t had any luck I’m affraid.
Is framing an affiliate website illegal?
I am using the zero-frame method to frame someone else’s website. I am not advertising or claiming it to be mine.
Hi Steven,
It’s not illegal but some affiliate programs won’t allow it, check their terms & conditions if you are unsure.
Neil
I tried it again and it worked perfectly! Thanks again!!
Thanks for this tutorial
it helped me so much
I need your help neil ,and if im sucessfull or anyonethat can help me i will reciprocate ….i have like 50 campaigns but i dont know what to do ……How do i post my affiliate links -using code…..How would i post my links using code to hide my affiliate links eg.How would i type my affiliate code plus +the cloaking code together together -so that my hidden/cloaked-link appears…Where do i post my affiliate links,How do i post my links?
And how can i get alot of people to use my link any suggestions pleease???????Fustrated Newbie .Thanx..Pls post response here or to my email ..Galactus2010@gmail.com
Thanx again
Can you explain “link hijacking” more?
How can someone replace my pid with theirs?
They would have to hack into my website and alter the html coding?
Would encrypting your affiliate link solve this problem?
BLG
You’re going to have to be more specific with the How to hide your affiliate links on a web page.
Where is that piece of code supposed to be pasted/saved… and EXACTLY what is to be replaced in it…? I’m assuming
Anchor Text
The first link is replaced with your affiliate.. what about the second? What goes there? Just any old link you want it to display as?
Hi Fi,
You just past the code where ever you want the link to display.
The second link is just as is says, whatever you want it to display.
Neil