Best Way to Organize and Cloak Affiliate Links in WordPress

2009 October 30
by MK

organizelinks

If you currently have or plan to have plenty of affiliate links on your WordPress based website, you should have a way to easily track and manage these affiliate links. You want to know how many clicks each link received and you want to be able to edit and change the affiliate link without having to revisit and change old content.

And to keep your website clean and organized in the eyes of search engines, there are a few things that will need tweaking.

Here’s how I create, manage and cloak my affiliate links.

Using Redirection

Redirection is a WordPress plugin that is made by John Godley, who works for Automattic, the company behind WordPress. Redirection helps you manage your blog URLs. Using Redirection, you could create a link like http://msafi.com/gotogoogle/ and set that link to forward to http://google.com. Similarly, you could put all your affiliate forwarders in a virtual directory like:

  • http://msafi.com/affiliate/product1/
  • http://msafi.com/affiliate/product2/
  • http://msafi.com/affiliate/product3/
  • and so on…

Most people don’t use affiliate for the directory name, though. They use goto or visit. Or like on this website, I simply use a.

Redirection also allows you to group related URL redirections together. So, you could create a group, name it Affiliate Links and put all your affiliate links there.

Create an affiliate link in Redirection

Once you have Redirection installed

  1. Click on Groups in the top left corner
  2. At the bottom of the page, you’ll see Add Group. Enter Affiliate Links in the textbox, and click Add.
  3. Click on your newly added group, Affiliate Links
  4. In the source URL, put something like /visit/product-xyz/ (don’t include your domain name, http://ursite.com)
  5. For Match, select URL only
  6. For Action, select Redirect to URL
  7. Leave Regular expression unchecked
  8. In Target URL, put your affiliate link

That’s it. You’ve added your first affiliate link to Redirection.

Now whenever you want to link to Product XYZ, use http://ursite.com/visit/product-xyz/. It’s even easier to remember.

Redirection also gives you the number of hits each link received. So, if you’re putting your links in relevant places and getting huge volumes of clicks but maybe no sales, you’ll know something is going on…

Cool tip: get Redirection to automatically create ClickBank affiliate links for you!

If you promote products for ClickBank, here’s a cool tip that you’ll find very useful.

All of ClickBank’s links have the following structure

http://YourClickBankID.VendorClickBankID.hop.clickbank.net

You can tell Redirection to automatically fill in the VendorClickBankID field for you based on a value that you provide in your URL. Like:

http://ursite.com/cb/vendorx311/

automatically redirects to

http://yourClickBankID.vendorx311.hop.clickbank.net

and

http://ursite.com/cb/sumvendor2/

automatically redirects to

http://yourClickBankID.sumvendor2.hop.clickbank.net

…and so on…

Here’s how you do this in Redirection:

  1. In the Source URL, enter /cb/([^/]*)
  2. In Target URL, enter http://yourClickBankID.$1.hop.clickbank.net
  3. Make sure Regular expression is checked
  4. Match should be set to URL only
  5. Action should be set to Redirect URL

I have done this on my website here at msafi.com. So, now I can simply give out a link like http://msafi.com/cb/4idiots/. This will redirect to http://mksafi.4idiots.clickbank.net, which is the landing sales page for the product sold by 4idiots ClickBank vendor. You can replace 4idiots with any ClickBank vendor ID and it will still work.

Pretty cool isn’t it?

Perhaps a similar trick can be done to automate link cloaking and management for Amazon and Commission Junction, but I’ll have to look into that.

For now, let’s look into optimizing your affiliate links so that Google will not have trouble with them…

Helping Google not trip over your affiliate links

Now that you have a convenient and easy way to create and organize affiliate links, I’m gonna show you how to make sure that Google will not discriminate against your blog as a result of affiliate links.

First, whenever you add an affiliate link as anchor text make sure that you include a rel=”nofollow” attribute in the anchor tag. That is

Bad: <a href=”http://ursite.com/visit/product-xyz/”>Product XYZ</a>

Good: <a href=”http://ursite.com/visit/product-xyz/” rel=”nofollow”>Product XYZ</a>

If you want to automate the creation of anchor text links in WordPress, check out the plugin I created: Word 2 Cash.

Second, use robots.txt to disallow Google (and other search engines) from accessing your virtual affiliate links URL directories. Your affiliate link directories are /visit/, /cb/ and whatever else you may have created.

In your robots.txt file add lines like:

Disallow: /visit/*
Disallow: /cb/*

Do the same for any other affiliate link directory you have.

This will help Google index your website in a clean way and hopefully minimize discrimination against your outbound links.

That’s all there is to it. You now have a great way to create and manage your affiliate links. Just one last thing before you go.

Reducing Redirection database size

Redirection keeps a record of every redirect it makes. It stores these records in your database. If you’re gonna be using the plugin the way I described in this post, your records can build up and take a lot of space pretty quickly. What you want to do is set the records to expire after some time, say 30 days. To do that:

  1. go to Redirection’s admin page
  2. Click on Options
  3. In the Expire Logs field, enter 30 and click Save.

Aaaaaaand you’re done!

Do any of these posts interest you, too?

  1. Automatically Create and Cloak Amazon Affiliate Links in WordPress
  2. Squeezing the SEO Juice Out of Your Affiliates
  3. Great Networks for Software Affiliates and Vendors
  4. Turn Keywords into Links with Word 2 Cash
  5. Change Google Analytics Default View from “Month” to “Day”
No comments yet

Do you have a question, suggestion, or comment? Tell me!

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS