HowTo: Hide Affiliate Links

Affiliate marketing is one of the many ways blogs and bloggers generate income. I’m sure most of you, especially those who have blogs are familiar with this because some of you are also members of affiliate programs and have affiliate links across your blogs. Here on JaypeeOnline, I also have several affiliate banners and links which mostly are for premium WordPress themes.

So what’s wrong with affiliate links and why do we have to hide them? The problem with most affiliate links is that they’re ugly, too long and are suspicious looking to most blog readers or visitors. Here’s an example:

http://affiliate.domain.com/gateway.aspx?adid=1234567&sURL=http%3A%2F

Wouldn’t it be nice and look better if the link was something like this:

http://domain.com/link/affiliatelink.php

The idea of hiding or “cloaking” these affiliate links is to make blog readers think that the affiliate link is an internal URL or a part of the current blog. When a blog reader or visitor think that it is an internal link on your blog rather than a third party site, that person is more likely to click on the “cloaked” link than the normal affiliate link . Other benefits of “cloaking” or hiding affiliate links is that all our blog links point to an internal address on the domain and it also makes it more convenient for the blogger to update the affiliate links and avoid having dead links when the company updates or changes its affiliate links. Hiding affiliate links can also improve your conversion rate and an improved conversion rate can mean an increase in affiliate earnings.

There are several ways of hiding affiliate links, one is by using online services that shorten URLs like tinyurl or tr.im, another method is using javacript to change the URL’s text displayed on the status bar or installing WordPress plugins but most of them are not free. If you don’t want to spend extra cash just to hide your affiliate links and would want to do it yourself or want to avoid using a plugin, then this tutorial is for you. This tutorial uses PHP redirects which involves only a few steps and is quite easy to follow.

Requirements:

  • FTP client and FTP access to your web server
  • Text editor (if you don’t have one, you can get one from here or here)

Steps:

  • Create a folder on your blog’s root folder or public_html directory named “go”. (You can use a different name if you want)
  • Create a blank PHP document using a text editor. (Use same name with affiliate link to avoid confusion) ex. GoDaddy – godaddy.php
  • Copy and paste the following code into the blank PHP document: Affiliate Link Code
    (Replace http://youraffiliatelink with actual affiliate link)
  • Save the file and upload it to the “go” folder created in Step 1

That’s it! You now have “cloaked” your affiliate link. In case you need to create several PHP redirects for different affiliate links, just follow and repeat the steps listed above making sure that you name the PHP document with the same name as the affiliate link so you won’t get confused.

Your affiliate link redirect will look something like this:
http://yourblog.com/go/affiliatelink.php

I hope this simple tutorial has helped you improve your affiliate links and make it easier to manage without having to purchase a WordPress plugin and also help you improve your conversion rate and affiliate earnings. If you need assistance in creating the PHP redirects and setting it up on your blog, feel free to contact me or leave a comment on this post and I’ll do my best to help you.

JaypeeOnline is supported by its audience. When you click on the advertisements or purchase through links on our site, we may earn an affiliate commission. Learn more

Share:

administrator

Owner and editor of JaypeeOnline. Self-proclaimed geek. New media writer and consultant. WordPress advocate. Loves blogging, gadgets, video games and sports. You can follow him on Facebook or Twitter.

25 Comments

  • Kavita, September 6, 2010 @ 5:21 AM

    Hi Jaypee, Thanks for the post. I was looking for this information. My blog is hosted on godaddy and just now cloaked my godaddy affiliate url.

  • TheCaymanHost, March 11, 2010 @ 10:20 PM

    Whilst I realize this post was made a fairly long time ago I thought I’s add a few updates that might be helpful. I’ve written extensively about cloaking and redirect methods on my blog for anyone wanting more detailed information.

    TinyURL has been abused by spammers and as a result many applications including browsers such as Chrome reveal to the visitor the destination URL to help them avoid being send to a porn site or some other nasty places they may not wish to visit. Chrome actually directs visitors to an ugly preview page before they get to your site – this will guarantee the loss of visitors. So, for affiliate links it’s pretty dead in the water if you are trying to mask a link.

    Someone mentioned frames – cloaking using frames was once a good method but ceased to be a long time ago. IE for example will block cookies from domains other than that shown in the browser address bar – result, you lose more commissions than you protect! The visitor gets to your site but your cookie stands zero chance and you make nada, zip, nothing. IE’s standard privacy settings are something most people will never change and as the majority of web users still use the crappy MS browser you should never use frames unless you only want to sell to Firefox users ;-)

    I realize your method here is a straight PHP redirect – this is not a problem for cookie setting but…it is not very secure and more often than not the raw affiliate link will still appear in the browser address bar. If you want to track your links as well, this method falls short too and it’s more time consuming than it needs to be. Also, a growing problem is parasite software – I explain this on my blog too if you want more information but basically a PHP redirect is vulnerable to such trickery too.

    There are so many options for cloaking links and this is already turning into a blog post as opposed to a comment. However, there is a lot of bad information out there on this topic, a lot of software that can do more harm than good too, but there are some little jewels as well and whilst there is still no perfect way to guarantee that all your affiliate links will be correctly tracked to you, there are ways to maximize your chances. A quick search for link cloaking on my blog will lead you to some revealing information not often found if any of your readership are interested.

    Maurice TCH

  • barry, August 28, 2009 @ 3:40 AM

    I keep losing my affiliate links. After a day or two i would lose them, does any body knows why?

  • Gem, June 3, 2009 @ 11:16 PM

    Does this mean I have to change all the links in all my posts? I have over 200 posts and I wish not to back to my old posts.

  • JP Habaradas, January 8, 2009 @ 10:55 AM

    @SGDNetworks – Thanks for the compliment! Regarding your question, yes you’ll have to create individual php files for each unique product. For the example you used, if you have 10 PC Tools products, what you can do is create a file called pctools1, pctools2, etc. It can be a bit tidious but it will work.

    Also if you think this is too much work, you can try Get Shorty which is discussed several times in the comments. I haven’t tried it myself but I think it requires less work.

    Hope this helps. Let me know what method you decided to use with your affiliate links. Have a nice day! :)

  • SGDNetworks, January 8, 2009 @ 10:51 AM

    Hi Jaypee,

    Thanks for the nice post. But i have a doubt like if i have 100’s of urls’ then? for example i wish to promote pctools.com products, it have about 10 products. So i need to create 10 product php pages with each proper product affiliate link right?

    Please clarify me.

    Venkat

  • JP Habaradas, January 5, 2009 @ 11:30 AM

    @Film-Book – Thank you! Get Shorty is not a WordPress plugin. It’s a third party program that you’ll have to install yourself. You can get it from here: http://get-shorty.com/

    Thanks for sharing those links from John Chow. I’m sure someone will find those useful too. It would be good to have you around here. Have a nice day! :)

  • Film-Book dot Com, January 5, 2009 @ 11:25 AM

    Nice post Jaypee. I haven’t been here in awhile.

    Is Get Shorty a WordPress plugin? Where can I get it?

    I found these other methods for hiding affiliate links a while ago. I thought you readers would enjoy them as well. The first method is very similar to yours. Chow modifies it so he can track clicks on those in Google Analytics. Very cool.

    http://www.johnchow.com/hiding-affiliate-links-for-better-seo/
    http://www.johnchow.com/how-to-hide-affiliate-links/
    http://www.johnchow.com/evil-affiliate-marketing-trick-of-the-day/

    I’ll be on your site more often so look out. :)

    Film-Book dot Coms last blog post..Street Fighter: The Legend of Chun Li Poster

  • JP Habaradas, December 27, 2008 @ 12:50 AM

    @loy – Thanks for the link! I’ll bookmark it in case I’ll be needing any PHP scripts in the near future. :D

  • loy, December 27, 2008 @ 12:45 AM

    I actually got the script from PHPJunkyard The installation and configuration is relatively easy, easier than some WP plugins around…hehe…

  • JP Habaradas, December 26, 2008 @ 6:20 AM

    @Alwin – Thanks for sharing! Although, there’s one problem with your method which is the use of frames. Why? Because frames violate many web standards.

    Frames don’t work well on all browsers especially on mobile devices. Also, if you rely on search engine traffic using frames is a big problem because search engines have problems reading frameset pages.

  • Alwin Chuah, December 26, 2008 @ 6:18 AM

    Hi Jaypee

    I have written a similar topic in my blog. However my approach is slightly different.
    Take a look at my blog:

    http://www.globalblogincome.com/blogresource/free-method-to-hide-your-affiliate-link/

    Cheers
    Alwin Chuah
    http://www.globalblogincome.com

  • JP Habaradas, December 21, 2008 @ 7:30 PM

    @loy – Haven’t tried that one too. Did you write/create the PHP click counter script by yourself? Is it easy to install/configure?

  • loy, December 21, 2008 @ 7:28 PM

    How about the Mod rewrite method? Haven’t tried it, though :-) I’m using a PHP click counter script to hide my affiliate links.

  • JP Habaradas, December 20, 2008 @ 2:20 AM

    @Pavel – You’re welcome and thanks for dropping by! Your blog is now one of my favorite blogs and daily reads. :)

    Btw, I tried visiting your blog the other day and I kept getting a page can’t be displayed message. Well it seems that its working fine now but just wanna let you know. Happy Holidays!

  • Pavel Ciorici, December 20, 2008 @ 2:15 AM

    Thank you for this great tip ;)

    Pavel Cioricis last blog post..Best Free WordPress Themes in 2008

  • JP Habaradas, December 20, 2008 @ 12:10 AM

    @jhay – Thanks dude! I guess Get Shorty is easier to use but I haven’t tried it. Have you?

    Btw, have you received the “thing” I sent you? Please let me know when you do. :)

  • jhay, December 20, 2008 @ 12:07 AM

    Good trick. Though iRonnie’s tip is a tad easier. ;)

    jhays last blog post..What’s the future of the Internet?

  • JP Habaradas, December 19, 2008 @ 10:00 PM

    @Fitz – Using tinyurl or other link shortening services is also another option, however your links become “artificial” and becomes a bit suspicious looking to some readers/visitors.

    I’m not sure if I can consider myself into heavy affiliate marketing but I agree with what you said. Its good to disclose that you have affiliate links on your blog. I haven’t really thought about that and might consider doing that here. Thanks for sharing and pointing that out! :)

  • Fitz, December 19, 2008 @ 9:57 PM

    I actually just use tinyurl to make my affiliate links “prettier”.

    Anyway, when you are into heavy affiliate marketing, I think it’s better to disclose to your readers that they are affiliate links and most, if not all, of the time – they don’t really lose anything from using your affiliate links.

    Fitzs last blog post..Discover Your Strengths, Find Your Passion

  • JP Habaradas, December 19, 2008 @ 9:15 PM

    @joie – You could’ve asked me about it. Then I would’ve helped you or made this tutorial earlier. Next time you need help with something, just let me know, ok? You’re welcome! ;)

  • joie, December 19, 2008 @ 9:13 PM

    Finally, I was wondering when are you going to make a tutorial for that. I did get the idea of redirecting the affiliate URL from internal file using php from your site. It took me a while to figure out how did you do it, but after sometime of reading php tutorials i manage to redirect my affiliate links using the same method as yours. Still, thanks for sharing..

    joies last blog post..{Skywatch 13} Hongkong

  • JP Habaradas, December 19, 2008 @ 5:30 PM

    @iRonnie – Hi there! Long time no see here. Hehe anyways, thanks for sharing about Get Shorty. I’ll have to try that one of these days and maybe write a part two of this tutorial using Get Shorty. :D

  • iRonnie, December 19, 2008 @ 5:28 PM

    hi jaypee. i installed and currently using Get Shorty to get the job done. you might want to try it instead. No need to access your FTP. :D

    iRonnies last blog post..Lifetime Hosting For As Low As $50

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.