Last week I got round to one of those jobs that I’ve wanted to do for a while and that’s making my affiliate links a bit more visitor friendly and readable. I’ve mentioned before how I automatically convert links to sites that I have a relationship with to their corresponding affiliate links, I’ve now taken this a stage further and have created a Word Press plug-in to make it easy to add new affiliates as I find them.
The way the plug-in works is it searches for the domain of merchants that I have an affiliate program with adjusts it accordingly, for example http://www.thinkgeek.com/ would be converted on the fly to the equivalent affiliate link of :
As you can see the affiliate link is pretty darn ugly and to the (slighty) trained eye it is obviously an affiliate link which does put some people (especially tech savvy webmasters) off clicking it.
<a href=”http:\\bloodylongafflink” onmouseover=”window.status=’http://www.ThinkGeekcom’;return true;” onmouseout=”window.status=’ ‘;return true;”>My Affiliate Link<a>
Which would then display like: My Affiliate Link, normally when you hover over a link the URL appears in the status bar at the bottom of the browser by using the onmouseover and onmouseout you can control what is displayed in the status, so instead of displaying a long affiliate code you simply show the original URL. Unfortunately this only works in IE, in FireFox nothing is displayed which will also put some people off from clicking (the example link will not demonstrate what I am explaining as Word Press strips the code).
The solution that I implemented last week was to convert all relevant outgoing links to an internal link that will automatically forward to the affiliate offer. So instead of having a mega long affiliate link that I can only hide from some browsers I now have what I think is a much more friendly status bar link so clicking here will take the visitor to my og.php (outgoing) page which then forwards them to the appropriate offer.
The next part of the project was to code the forwarding page, which forwards the regular URL to the affiliate page. I won’t go into how this works as it’s just a simple coding exercise that is out of the remit of this article.
I have however created a quick and dirty plug-in (I think all my plug-ins are quick and dirty) that you are free to use on your own WordPress blogs. To use simple download st_auto_affiliate_links.zip, unzip and upload the files to your plugin directory. Once the plug-in is activated you will have an options page where you can enter before and after URLs.
In the “URLs that start with” edit box add the URLs to the sites that you would like to be converted. On the corresponding line of the “Replace with” edit box enter the affiliate link that you would like your visitors to be forwarded to. There are a couple of paramters that you can use:
- %TARGET% – This is the original URL (useful for deeplinking)
- %ENCODED_TARGET% – This is the target encoded into a HTML string which some affiliate URLs need
I’ve created a few default affiliate converters, which you can change to suit.
If you need any help or have questions or suggestions please leave a comment,
I’ve only been running this script for about a week but so far commission have increased around 15% which is always nice to see