How to 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!

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

This entry was posted in Affiliate marketing for dummies, hide affiliate links and tagged , , , , , , , . Bookmark the permalink.

29 Responses to How to Hide Affiliate Links

  1. Kelly says:

    Useful script and info! Thanks Neil!

  2. 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

  3. Neil says:

    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

  4. Winson John says:

    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:)

  5. Neil says:

    Hi,

    I’m not sure about that, I don’t see why it wouldn’t work.

    Neil

  6. John Kerry says:

    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

  7. Neil says:

    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

  8. Please review your PHP code.
    <?php header(“location: http://www.breakthru.com/go/g788606-pmem“); ?>

  9. Neil says:

    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

  10. Taylor says:

    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.

  11. Neil says:

    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.

  12. Steven says:

    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.

  13. Neil says:

    Hi Steven,

    It’s not illegal but some affiliate programs won’t allow it, check their terms & conditions if you are unsure.

    Neil

  14. Anton says:

    I tried it again and it worked perfectly! Thanks again!!

  15. Thanks for this tutorial :) it helped me so much :)

  16. corey says:

    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

  17. 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

  18. fi says:

    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?

  19. Neil says:

    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

  20. Sharon says:

    I give u 5 stars plus. I finally found the solution to my problem, with your zero frame script. i’d searched and searched for masking. only php and 301, was not what i wanted, but that’s what u see everywhere.

    Finally, i came to your page, and your script does exactly what i want it to do. and you have the code set up so nicely to copy and paste.

    i even went through a domain registrar, whose tech support, couldn’t even help me with proper, url framing, so that my www would show up. it’s namecheap by the way. terrible tech support! you shouldn’t even need tech support, for simple url forwarding. but they way they have it set up, they don’t even understand it. geez.

    thank you again, pls. keep up the good work.

    SC

  21. johnny says:

    120% great work done here. Thank you for providing such useful information. I had same situation like SC, asking tech support of my web hosting, they just give me a link, with all the tech info I couldn’t understand, your explanation are way much better than tech support. Your work, Neil….

  22. Saurav says:

    Hello Neil, thanks for the tips, but if I use many affiliate links such as amazon products, then which method should I adopt?

  23. Neil says:

    Hi Saurav, I use http://w-shadow.com/blog/2007/07/28/link-cloaking-plugin-for-wordpress/ on some of my WP sites, there are other WP cloaking plugins out there though.

  24. mike says:

    seriously thanks man, finally a tut with the proper php sequence, much appreciated dude

  25. mark says:

    Hi your code works for a single like link as a name

    but how to i ad the image to the code I get errors

    Anchor Text

    my affiliate link comes with an image

    where abouts to I place the code

    I have tried everywhere?

    IT shows on other parts of the code on the site when I try so musnt be putting the image in right section?
    I’ve tried below the link
    above ect
    not working

    I’m limited at html so I’m sure its something simple

  26. Neil says:

    What type of cloaking are you trying to use Mark?

  27. Terry says:

    Hello Neil,
    I tried the “onclick” method on this website- worldprofit.WS- using the text input box with the source code being the “onclick”, but this is what I got after I sourced it and saved it and went back to try and fix it when it didn’t work:
    Anchor Text
    As you can see, it automatically moved the “href display-link” to the front of the code enabling the “clicker” to go directly to the REAL site I don’t want them to- it doesn’t go to my affiliate link at all. The ‘anchor text’ is fine, but that’s it.

    Please advise,
    Terry

  28. Neil says:

    Hi Terry,

    I’ve emailed you the code, just cut and paste.

    Cheers
    Neil

  29. Mike says:

    I’d never heard of link hijacking before. Unbelievable. I’ll be studying more how to prevent this. Good god.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>