If you have an Amazon Associates account, you might be wondering about the best way of managing your links. Sure, you could create a different link for every product, but that quickly gets unwieldy. Surely there’s a better way. Right?
Wouldn’t it be nice to feed the product ID into a standard link and let your web server craft the link for you?
What I’m talking about here, of course, is creating a redirect for your Amazon (or other) affiliate links. If you’re using WordPress to run your site, you could use a plugin to manage your affiliate redirects. But, as I’ve noted before, I don’t like using plugins for things that can be easily achieved with a bit of custom code.
What happens if the plugin’s creator loses interest and stops updating? It happens. And if it happens to you, you’ll be stuck with a huge cleanup project on your hands. Not worth it when you can roll your own solution in less time than it takes to find and install a plugin. Plus, the method outlined here works for just about any backend, not just WordPress.
The simplest solution (in my book) is to create a PHP redirect. To do this, create a .php file (i.e., just a text file containing a bit of PHP code) with the following:
<?php
$asin = htmlentities($_GET['asin']);
$link = "http://www.amazon.com/exec/obidos/ASIN/".$asin."/ref=nosim/jammersix-20";
header("Location:".$link);
?>
(sorry about the awkward line wraps)
Be sure to replace “jammersix-20” with your own affiliate ID — or don’t, if you’re feeling generous.
I named this file amazon.php and stashed it in /external at the root level of the domain. Thus, to use it, I simply link to:
http://www.jammersix.com/external/amazon.php?asin=xxxxxxxxxx
If you replace xxxxxxxxxx with the actual Amazon product ID number (ASIN = Amazon Standard Identification Number) the redirect will produce a well-formed Amazon link with your Associates ID that points to the product of interest.
The end product will look like this:
http://www.amazon.com/exec/obidos/ASIN/xxxxxxxxxx/ref=nosim/jammersix-20
For example, this link:
http://www.jammersix.com/external/amazon.php?asin=1430232498
results in an Amazon link that points to a handy book about PHP solutions for dynamic web design. The end product looks like this:
http://www.amazon.com/exec/obidos/ASIN/1430232498/ref=nosim/jammersix-20
Go ahead, click both versions. They work exactly as advertised.
Wondering how I found the ASIN? The easiest way is to just look at the page url after you’ve navigated to the product of interest. You’ll see it embedded in the Amazon url right after /dp/.
The beauty of this approach is that: (1) you’re not dependent on a third-party developer, and (2) if you ever change your affiliate ID in the future (or if Amazon changes the acceptable link structure) you only have to update it in one place.
{ 9 comments… read them below or add one }
Thanks for the tips. I use a redirection plugin which allows me to create a link using my own url. This way if they change the structure I just go in the back office and change the link that it directs to.
Hey I am so excited I found your site, I really found you by mistake,
while I was browsing on Google for something else, Nonetheless I
am here now and would just like to say many thanks
for a fantastic post and a all round interesting blog (I also
love the theme/design), I don’t have time to read through it
all at the moment but I have saved it and also added in your RSS
feeds, so when I have time I will be back to read a
great deal more, Please do keep up the great work.
Hi there it’s me, I am also visiting this web page regularly, this web page is actually pleasant and the visitors are really sharing nice thoughts.
I’ve often dreamt for being protected in a glass box immersed inside the mother nature. Bellissimo!
Hey very cool blog!! Guy .. Beautiful .. Amazing .
. I’ll bookmark your site and take the feeds also? I’m glad to search out so many
helpful information right here in the publish, we need work
out more techniques in this regard, thank you for
sharing. . . . . .
Hi there! I could have sworn I’ve visited this site before but after looking at a few of the articles I realized it’s new to
me. Regardless, I’m certainly pleased I stumbled upon it and I’ll be bookmarking it and checking back frequently!
hello there and thank you for your information – I have definitely picked up anything new from
right here. I did however expertise several technical points using this site, as I experienced to reload the web site
lots of times previous to I could get it to load properly.
I had been wondering if your hosting is OK? Not that I am complaining, but sluggish loading instances times will often
affect your placement in google and could damage your high
quality score if ads and marketing with Adwords. Well I
am adding this RSS to my email and can look out for much more
of your respective intriguing content. Ensure that you update this again soon.
Just want to say your article is as amazing. The clarity in
your post is just excellent and i could assume you’re an expert on this subject. Well with your permission allow me to grab your feed to keep updated with forthcoming post. Thanks a million and please carry on the rewarding work.
łapać Wagnera zanim odbijaniem wieka oraz
udowadnianiem, że miny meninettes.blogspot.
com trwają w charakterze prekursorskie, Frodo przeprosił go na pół godziny, podczas gdy
nuże wymógł na przedtem zacne przyrzeczenie, że poniekąd
nie zbliży się do skrzynki
ze stalową łapką do wyciągania gwoździ. Pół godziny przeciągnęło się do
dwóch,
jednak na końcu potrafił dać zobaczyć wydruk
dokumentu, kto wydębił z niemałym uprosił w
arc.