RSS Feed

Hidden Treasures

Bizquarium's Treasured Recommendations
Like what you see here? Subscribe to updates via RSS or email...

Keeping your affiliate links friendly and easy to manage

One of the most important methods of making money online is through affiliate relationships. With these, you typically get a cut when you recommend a product or service to someone and they end up taking the plunge and buying it.

I’d say the biggest hassle of affiliate programs is managing the links. These are ugly critters and if you recommend a wide variety of things on your blog, you’ve got a lot to keep track of.

Show me the ugly!

There is really no good reason to link to something like this:

(sheesh I had to use a line break on that one!)

.. when you can do it like this:

There are lots of good reasons to use redirects when linking to your affiliates:

  • Sometimes affiliate links change. Rather than have to go back through thousands of posts and hunt the little buggers down, you’ve got the ability to mange them in a central location.
  • Your link looks like an internal link within your site. This puts many people more at ease subconsciously.
  • By using something like “go/affiliateprogram” or “recommends/affiliateprogram” you show your readers exactly what is going on.
  • Affiliate links are usually long, messy looking and impossible to remember. This forces you to keep copying and pasting from your notes each time you want to build a link using. Precious moments of your life that are better spent elsewhere.
  • These long and messy affiliate links tend to scare people away from clicking them. Boo!
  • Some people, for deep seated psychological reasons that are still being studied, love to take the extra time to avoid clicking on a naked affiliate link and to retype the web address into their browser.
  • Search engines are beginning to get snippy and throw penalties at people if they don’t happen to like the ways in which you make money online. Anything you can do to obfuscate things is probably in your best interest.
  • Some affiliate links use JavaScript. These are a pain to deal with in general and within WordPress in particular.
  • You end up spending less time and making more money – Tim Ferris would be proud!

OK, how do we skin this cat (and get our 10% of all the cat skin sold!)

The way we accomplish this is by redirecting a simply and clear web address on your website to the complicated and confusing affiliate link.

There are a variety of ways of doing this. If you are not using WordPress you can make a basic webpage in PHP and include code that looks like this:

Example of PHP affiliate redirect

Ah, but as with most things, it all gets easier with WordPress

One of the great things about using WordPress as a content management system for you blog or your website is that it has a plugin architecture which makes most anything possible if your pour enough programmers into it. It also has an ubertalented and enormous development community happily whittling away at the Web’s problems. This case is no exception.

Mihai Secasiu of Patchlog has written a plugin for WordPress called Hidden Affiliate Links that handles all of this easily. You can download the plugin here (version 0.2), but make sure you read about it on the original post.

There are a few installation difficulties

The plugin is pretty easy to use. The only problem is that in installation there is at least one minor glitch to solve. You need to go into the Plugin Editor or use your favorite text editor to change line 16 of the file hidden-affiliate-links.php to reflect the proper version by changing:

Fix #1 to Hidden Affiliate Links (before)

to read:

Fix #1 to Hidden Affiliate Links (after)

(if yours already reads 0.2 then Mihai’s already fixed it)

Also, if you are like me and have WordPress installed in a subdirectory to keep thing clean you’ll need to fix another glitch on lines 279-281 by changing:

Fix #2 to Hidden Affiliate Links (before)

to read (includes the ABSPATH):

Fix #2 to Hidden Affiliate Links (after)

I have a doctored version of this file ready for download to make this easier.

Once you get this all solved, you install it and activate it in typical WordPress fashion. This will create a new menu under Manage in your control panel titled Hidden Affiliate Links which looks like this:

Example of Hidden Affiliate Links plugin

As in the above example, you want to put the path you want to use under Match Slug, the affiliate link or JavaScript snippet under Redirect to Link/Code, and a description for the link under Description.

There are a few advanced features as well, such as the ability to type in a keyword in your post and have it replaced by your affiliate link. I’ll talk about these in a future post.

When you’re all done you’ll have nice looking affiliate links like this one.


  1. Patches and Hacks - October 16, 2007 - 9:34 am

    Hey, Thanks for the fixes.
    Was the second fix really necessary ? Did you really have problems with those relative paths ?

  2. mblair - October 16, 2007 - 9:42 am

    Your welcome! It appears that adding ABSPATH is necessary in the case where WordPress is installed in different folder than you are accessing it from. Without ABSPATH, it goes to include the file from what it thinks is the root but may not actually be so.

    If someone is accessing WordPress from exactly the folder as it is installed in, as is usual, then I’m pretty sure that the way it originally was will work fine.

  3. bonafide - December 14, 2007 - 1:30 pm

    ok, a real noob question… can you please give me a step by step in how to use this… I want to do the hide affiliate links trick, but I’m not seeing what I need to do in a practical sense. when you say match slug, what is that? is it the word in a post? is it a link that is in a post, is it data contained in a post? a walkthrough from start to finish would be way cool


  4. Melvin Richardson - March 19, 2008 - 3:46 am

    Thanks for all of the great tips. This is really great information that I can put to use. There is another site that shrinks links at tiny


  5. patricia - November 14, 2008 - 6:59 am

    nothings happend, even with you fix version.
    is this plugin useful for 2.6 wordpress version?