A Better Way To Manage Affiliate Links

One of the more lucrative monetization methods for a blog is affiliate marketing (or referral marketing). Basically, you set up your blog with an affiliate link (or referral link) and send traffic to your advertiser. For each visitor that completes an action — i.e., subscribe to a service, buy a product, etc. — you’ll get paid a fixed amount or a percentage of the sale as compensation.

Three Problems With Affiliate Links

1. Non-Descriptive

Non-descriptive affiliate links are the ones that don’t tell the user information about the site it is leading to. This is a common problem with program like Commission Junction where a typical affiliate link looks something like this:

http://www.anrdoezrs.net/click-2899932-8291847

By the way, that’s the affiliate link for Lunarpages web hosting. However, with all the phishing scams, visitors are less inclined to click on a non-descriptive link because they are not sure where they will end up.

2. Complicated

Complicated affiliate links are the excessively long ones. For example, this is an affiliate link for a Garmin Nuvi GPS through Amazon.com:

http://www.amazon.com/gp/product/B000H49LXQ?ie=UTF8&tag=thelifsph0c-20
&linkCode=as2&camp=1789&creative=9325&creativeASIN=B000H49LXQ

That’s a pretty long affiliate link.

3. Hard To Update

As your blog ages, it could contain hundreds or even thousands of affiliate links. This presents a challenge if one of these links needs to be updated. For example, eBay recently left Commission Junction and started its own affiliate program, forcing publishers to update all eBay affiliate links.

Using PHP Redirect To Manage Affiliate Links

The three problems above can be addressed with a simple solution if you know a bit of PHP. We will use the Lunarpages link as an example.

First, you need to create a PHP file that redirects visitors to the affiliate URL when called — let’s call it lunarpages.php. This is how the file would look like:

<?php
header( ‘Location: http://www.anrdoezrs.net/click-2899932-8291847′ ) ;
?>

Note the Lunarpages affiliate link.

Second, upload the lunarpages.php file to your web server. I keep my PHP redirect files in a folder called go. For example:

http://www.blogthority.com/go/lunarpages.php

Now, I can simply link to this nicer looking link that tells my visitors that it goes to Lunarpages instead of the ugly “anrdoezrs.net” link. Try it: http://www.blogthority.com/go/lunarpages.php

A Better Way To Manage Amazon Affiliate Links

It would be extremely time consuming to manage Amazon affiliate links using the above method — i.e., one PHP file per product. Fortunately, we can use a PHP variable to solve the problem — this way, one PHP file can handle multiple products.

First, the PHP file. Let’s call it amazon.php. This is what it would look like.

<?php
$asin = htmlspecialchars($_GET['asin']);
$link = “http://www.amazon.com/gp/product/” . $asin . “?tag=your-affiliate-ID”;
header(”Location:”.$link);
?>

Note, be sure to replace your-affiliate-ID with your ID. Again, upload the file to your web server. Now, when I need to link to an amazon product, I can do the following:

http://www.blogthority.com/go/amazon.php?asin=B000H49LXQ

This is the equivalent of the long affiliate link in #2 above. Try it: http://www.blogthority.com/go/amazon.php?asin=B000H49LXQ

If you ever need to update any of these links, all you have to do is update the PHP file — one change and you’re all set!

Get Free Email Updates
emailLike this article? Enter your email address and click "Subscribe" to get the latest articles sent to your email for free. Your email will only be used for this daily update and you can unsubscribe anytime.

* Subscribe via RSS now

Related Tags
, , , , , ,
Pinyo
Pinyo is the owner of Moolanomy: personal finance blog and Blogthority, and founder of the M-Network: personal finance blogs network.

All posts by Pinyo

15 Comments

  1. gravatar
    That One Caveman
    July 2, 2008, 11:03

    Thanks! I knew it had to be simple, but I just never bothered to figure it out.

    Another side benefit is that you can better track who and how often these are clicked by checking your own server logs for the hits to these php pages.

  2. gravatar
    AP
    July 2, 2008, 15:34

    Does this also help with SEO? i.e. you are outbound linking to your own website rather than linking to some redirect.

  3. gravatar
    Auctionfreedom
    July 2, 2008, 21:26

    Great tips. Your PHP file codes are definitely a nice way to make a link a professional. I am a big fan of eBay affiliate program. I have bunch eBay affiliate websites. Their recent changes of leaving Commission Junction really made me sick. It took me lot of time to convert my all site. I have a feeling that thier all new eBay links are not tracking commissions properly.

  4. gravatar
    Pinyo
    July 15, 2008, 20:54

    @AP — I am not an SEO expert, but I assumes it helps by reducing the number of unnecessary outbound links.

    @Auctionfreedom — I am sorry to hear about your predicament. I just joined the new eBay program, but I make minimal amount so I can’t really compare. I supposed any program could cheat us out of our money if they wanted to.

  5. gravatar
    Mrs. Micah
    July 17, 2008, 14:37

    Pinyo, that’s amazing. :) This is getting del.icio.usd onto my to-do list. Especially the Amazon one…so much easier to manage.

  6. gravatar
    Patrick
    July 17, 2008, 16:17

    Very slick. I wish I would have known a bout this when I started out, but no worries. I’m thankful a friend showed it to me recently and I do it for most links now.

  7. gravatar
    Frugal Dad
    July 23, 2008, 9:02

    Thanks for solving the mystery (for me) behind how to do this. I see implemented at most of the “big” blogs now, but never knew how to implement it. Great stuff!

  8. gravatar
    DR
    August 19, 2008, 22:17

    Pinyo, great article! I’ve used php redirects before, but not quite the way you suggest. I implemented your suggestions in a couple of minutes and it worked like a charm. Thanks!

  9. gravatar
    Lazy Man and Money
    August 22, 2008, 12:45

    I do the first redirect, but I don’t do the Amazon one. I feel that Amazon is a pretty trusted source and people are generally not upset by clicking on it. If they can read the link text, say Garmin Nuvi and scroll over it, it should be all they need.

  10. gravatar
    Pinyo
    September 15, 2008, 22:56

    @Mrs. Micah — You’re welcome. I learned this trick from the best in the business. ;-)

    @Patrick — Yeah, any new trick is a pain to implement if you’ve been at it for a while.

    @Frugal Dad — Took me a while to learn it too.

    @DR — You’re welcome. Glad to hear it works well for you.

    @Lazy Man — You have a point about trust, but I like the ease of setting up new referral link without knowing the structure of the long URL and without having to go into Amazon Affiliate interface.

  11. gravatar
    Rufas
    November 7, 2008, 15:31

    The amazon.php script doesn’t work. It gives me this error:

    Parse error: syntax error, unexpected ‘:’ in amazon.php on line 3

    Any help?

  12. gravatar
    Pinyo
    November 10, 2008, 11:47

    @Rufas — I think it may be quote problem since WP automatically replaces normal quotes to smart quotes. Try this.

    < ?php
    $asin = htmlspecialchars($_GET['asin']);
    $link = "http://www.amazon.com/gp/product/" . $asin . "?tag=your-affiliate-ID";
    header("Location:".$link);
    ?>

  13. gravatar
    Rufas
    November 11, 2008, 8:29

    Thanks Pinyo, It works wonderfully now ;-)

  14. gravatar
    Bill
    November 27, 2008, 3:14

    Great tip on Amazon. I hate going to their Affiliate site.

  15. gravatar
    Trevor @ Financial Nut
    April 16, 2009, 13:11

    Interesting approach. Thanks for sharing. Thought I’m not huge into affiliate marketing, this is a great way to do it.

Please share your comment:

Please read our comment policy and guidelines.


Please do not use the name of your site or keywords.

1 blogs that link to this article:

If your trackback does not show in 24 hours, please resend to this trackback URI.

  1. Social Media Tip For Bloggers: Link Your Social Media Profiles To Your Blog URL | Bible Money Matters

Recommended Articles

Browse Categories

Related Articles From Blogthority

Related Articles From Other Sites

Featured Sites

Archives By Year

Blogroll