Creating quick, short Affiliate links

Ever since my recent redesign (and subsequent drastic increase in activity), I’ve started using Affiliate links when linking to good books, games, and so forth that I am currently experiencing. I hate the idea of advertisements on, and since I was planning on sharing opinions on books/etc. anyway, this seems like a pretty unobtrusive way to create a small possibility of revenue. My pie-in-the-sky dream is that someday will pay for its own hosting costs. That will be a good day.

In any case, I’ve only recently started using affiliate links, and may I just say that has a terrible system. You have to visit their Affiliate Central. Then log in. Then view all their widgets and so forth. Then choose the Product Links option. Then search for your product. Find the product in the search results. Die of boredom.

And the URL’s hideously long. Some monstrosity like this:

It makes me cringe. I’ve been searching for a way to quickly build my own Affiliate links; since I’m just using simple text links, I see no reason to jump through Amazon’s hoops. My goal was something that doesn’t require me to sign into Amazon and that gives me drastically shorter URLs (because long URLs make it difficult for me to read my post’s code):

These do not seem to me impossible demands. I searched for a Mac OS X Dashboard widget that would let me find products on Amazon and automatically generate an affiliate link: no love. Searched for blog posts about how to do this: Dave Taylor had some interesting advice, but it seemed outdated (given that I’ve never seen the types of URLs that he uses as examples before), and Noah Coad’s regex, while definitely good to know for non-affiliate links, doesn’t mention how to append an affiliate ID. Chris Thomson posted Using Amazon Associates Easily in MarsEdit recently, but his solution churns out hideously long URLs (and his MarsEdit macro forces you to input text; I don’t like doing that).

So here’s what I’ve come up with, which is hardly revolutionary. First step is to search for something via Amazon’s normal webpage (forget that convoluted affiliate link generating crap). You’ll get something hideous like this:

Yuck. The part that you want is the string of letters and numbers immediately after /dp/. This is the product ID. Copy it out of your address bar.

Now you just need to construct your shortened version. Insert the product ID into a URL that looks like this:

Of course, use your own affiliate ID instead of “beckism-20”, and stick the product ID after /dp/.

This link is the smallest format that I can find that is recommended by multiple people on the Amazon Affiliate discussion boards. I’m curious, however, if Dave Taylor is still correct about just slapping the tracking ID onto the end. If you’d like to help me test this, click here (I don’t expect you to buy Neverending Story, although it’s a classic and well worth reading, but in a day or so the affiliate reports will show that someone clicked a link, and then I’ll know for sure; currently the affiliate ID in the link hasn’t been published anywhere else).

I’m sure this is a common problem, so let me know in the comments if you’ve heard of a better way. Also, be aware that there’s the possibility that shortening your links down like this may disable some of Amazon’s fancy reporting stuff. I have no idea (or any way to test it).

Lastly, if you’re using MarsEdit, you can make the link creation process incredibly easy. Open up a post (or new post) and choose the “Markup” dropdown in the toolbar (or select Post→Text Markup→Edit). Click the + button to add a markup macro, name it whatever you like, and stick this in the opening tag:

<a href="">

(Again, replace “beckism-20” with your Amazon Affiliate tag.) The closing tag is obviously just </a>. If you like, assign a keyboard shortcut for easy access. All you need to do to use the macro is to copy the product’s ID (which follows /dp/ in the standard Amazon URL) before selecting the MarsEdit macro. The macro will deal intelligently with selected text (or lack thereof) without your needing to do a thing.

Update April 13, 2008: After a couple of other people have tested the linking in the comments (and having myself tried both the shortest method and the method I recommend in the article above), it turns out that the format does not work. The shortest format you can use is (a similar format is additionally cited on Amazon’s own blog, so presumably it will be valid for the foreseeable future).

55 responses to “Creating quick, short Affiliate links”

  1. Thanks for the link love. I’m one who hates long URLs too, but for the end user, I want them to see the shortest URLs possible for after they click them. It’s a personal preference, really.

    I do like your #pastetext# idea for the product ID. Good thinking. I’m changing my MarsEdit settings to reflect that. :)

    Thanks again for the link love.

  2. Ian Beck says:

    Thanks for writing a useful article on the topic! I had a terrible time finding info about this, which is surprising given the number of people you’d think must come up against the issue.

    Glad you like #pastetext#. I figured I’ll never use the macro unless I have a product ID in the first slot of my clipboard, so it seemed like a good idea.

  3. Ian Beck says:

    Glad you enjoyed it! The tracking ID got a couple hits, so it looks like this format will indeed work:

    Obviously you’ll need to replace the number with the product ID and “beckism-20” with your affiliate ID.

    I’m going to do a little more testing with alternates and another unused tracking ID, though, before I update the article, though. From some early tests I did (that I can now check on) it looks like while the code above will work fine, if you add a trailing backslash Amazon won’t notice the affiliate ID (so /beckism-20/ won’t work, while /beckism-20 will).

  4. Roger says:

    Hi Ian,

    Good post. Any results yet for the shortest possible URL? viz. just putting the Associates ID after the Product ID?


  5. Ian,
    Dude, you rule! I too recently started experimenting with Amazon affiliate links (and for the same reason, I don’t want to bombard people with ads, but if I’m going to genuinely recommend something anyway, what the hell?) and did a Google search trying to find a better way to solve the problem. And you double-rule for writing the MarsEdit macro so that I don’t have to!


  6. Ian Beck says:

    Glad you found the article useful, Christina! I actually wrote it because I did that exact same kind of search and came up with zilch; seems odd that there isn’t more info out there about this.

  7. Manish says:

    If you use RocketPost, the affiliate tag is automatically added to your Amazon links. Just type in the tag in Tools/Affiliate Links:

    Disclaimer: I designed the feature :)

  8. Ian Beck says:

    Of course, the fact that RocketPost is Windows-only kind of cuts down on the usefulness for myself and most of the people who read this blog… :-)

    MarsEdit FTW!

  9. Steve says:

    I’m low volume when it comes to published amazon links, and even lower volume when it comes to clicked amazon links :). I have already made the mistake of having a trailing backslash after my links, but after having fixed that, it doesn’t seem like the clicks are coming through. The links definitely work. But I’m wondering how sure you are that this is a viable format?

    Does this look right to you?

    (sorry about the link, I’m just trying to make sure that I’m following you correctly).

  10. Ian Beck says:

    Hey Steve,

    As best I can tell, that link format should work. To help you test it, I clicked through, added the item to the shopping cart, and proceeded to checkout (didn’t buy it, though; sorry). Let me know if you don’t have a click on your link report tomorrow!

    It’s always possible that the link format isn’t working with Amazon and I haven’t noticed because of my own low-volume clicks. :-)

    If that’s the case, though, I’d like to know about it. My Amazon stats indicate that I have gotten clicks to the new link-style tracking ID, but far fewer than when I was using the old style. Possibly it isn’t working.

    The format that I talk about in the original post (using ?tag=beckism-20) is one that I’m more confident about, too. If you try using it and have a noticeable increase in Amazon Affiliate links, can you let me know? I’d love to figure out once and for all what works and what doesn’t.

    It’s ridiculous that Amazon doesn’t have any information about this kind of thing. I need to try and dig up a contact for them to see if support has any input.

  11. Steve says:

    Hmm… The last click I see is on 3/22 – definitely before I posted this.

    I’m going to give it a shot with the tag= syntax – slightly longer, but maybe it will work.

  12. Steve says:

    You know, the ?tag=associatesid format is mentioned on the official associates blog here:

    They specifically mention it as a way to link directly to the Kindle.

  13. Steve says:

    I’m taking over your comments here. Sorry. I did want to update you that the ?tag=affiliateid format is definitely showing clicks now. Thanks for your help tracking this down.

  14. Ian Beck says:

    Hey Steve, no worries about taking over comments. Thanks for the info! That’s definitely good to know. I will convert my own links to the ?tag format, and will try to remember to update the article accordingly.

  15. Nick says:

    Hey Ian

    Thanks for the great post.

    Do you happen to know if this shortened URLs work with other Amazon stores, like Amazon UK, DE, etc??


    Nick :)

  16. origamifreak says:

    Firefox has an extension which generates these, called “Affiliator.”

  17. Sunrise says:

    Hi Ian,
    Thank you for your good article. I concern about affiliate id after “?tag=xxx”. Is it necessary to use the associate id that amazon create for us? (the first id) I mean can I use my tracking Id which I had built instead?

  18. Ian Beck says:

    Hey Sunrise,

    If you’re created multiple tracking IDs (so that when you sign it says in the box at the upper left “Signed in as [Amazon-created ID]” and underneath has a drop down of tracking IDs), you can use any of the IDs in the Tracking IDs dropdown. For instance, the ID I used as an example in the article (beckism-20) is not the one supplied by Amazon (beckismcom-20).

  19. Sunrise says:

    Thank you so much Ian.

    Your answer is very clear and i am brave enough to use it.

  20. Sunrise says:

    Hey Ian,

    May I ask (again), how do you think about this link “hxxp:// tag=associate id” ? I found someone used it.

  21. Ian Beck says:

    Hey Sunrise,

    My guess is that that link format will work fine (although please note I’ve never tested it). I think in general as long as ?tag=ID-20 is attached to the end correctly (that is, correctly in regards to URL syntax) that the link will probably work.

  22. iAN says:

    Much thanks, Ian! I was able to use the info here and in the comments to tweak Ecto3 to use the short URLs.

  23. Ian Beck says:

    Glad to hear it! Any tips and tricks for other fans of Ecto 3 for getting it to work? It’s been so long since I last used Ecto that I can’t even think of how you might go about this. :-)

  24. iAN says:

    @ian: I’m new to the Mac world and still flip-flopping between ecto3 and MarsEdit2 :]

    For ecto, under the Amazon Helper settings, I removed the incredibly long default string and replaced with this:

    My setup just links the image, but there are variables included for the product name, as well.

  25. iAN says:

    Hah, ok I guess it didn’t like that link.$asin$/?tag=ID-20

    $asin$ is the ecto3 Amazon Helper variable for the all-important product ID string.

  26. Joost says:

    Thanks for the pointer! Such basic info, but hard to find…

  27. Kevin says:

    Very helpful, but what do you do to track impressions?

    Normally amazon uses a suedo image like this:

    <img src=”″ width=”1″ height=”1″ border=”0″ alt=”” style=”border:none !important; margin:0px !important;” />

    For now I am programmatically replacing the productID with my server side code.

    Love the short URLs though, not I just save the product ID in my DB and generate the short url on the fly. awsome, becuase I can use the id to make image links, text links, etc…

  28. Ian Beck says:

    Hey Kevin,

    One of the downsides to using the short syntax described above is that you can’t use some of Amazon’s more advanced tracking tools. This doesn’t really matter to me personally, since I’m not remotely trying to make a living off blogging, but it’s certainly something to keep in mind.

    I’ve been using Mint to track visitor actions for some time, and I recently switched over to Get Clicky to track visitors across all my sites and have better access to historical data. Likely neither will work great for tracking Amazon Affiliate performance, but for my casual use both are definitely useful.

  29. susan says:

    Hello – how did you obtain your affiliate id from Amazon?

  30. Ian Beck says:

    Hey Susan,

    Sign up for an Amazon affiliate account, and the affiliate ID should be in a box at the top right corner of the page when you log in (it’s very prominent). If you need further help with this, you should contact Amazon support.

    Good luck!

  31. Tessa Green says:

    Hello everyone, please can you help? First, thank you Mr Beck for this brilliant article. So, I would like to write about a group of items. I’d like to introduce them collectively, with a nice picture, before discussing each item separately. I’d like the picture to be clickable. Would be nice for the click to land on Amazon’s search result page for that item, and for me to get the credit. So I added the /?tag=ID on the end. Not work. I guess because I’ve introduced a second ‘?’. So I study my Amazon generated affiliate URL and try adding ‘&tag=ID’ . I get the search page and my ID in the browser window. My questions are, does that seem okay to you (I’m NOT techy at all)? and if a visitor then clicks on an item on that list, do I continue to get credit?

    Sorry this is so long. I look forward to your reply. Thank you.

  32. Ian Beck says:

    Hey Tessa,

    Although this seems like it should work to me, you’re best bet will probably be to use the Amazon tools to generate a link to the search results page (as long and hideous as it may turn out to be). I’ve only ever tested this shortened version of the Amazon URLs with products, so I’m not sure if it will work or not with other types of pages.

    Just FYI, you can’t do two question marks in a URL because the question mark marks the place where the URL starts to list variables. The ampersand is what separates each variable so that the server knows where one ends and the next begins, which is why using the ampersand is more likely to work.

    Good luck!

  33. Tessa Green says:

    WOW, Mr Beck, thank you for replying so swiftly, and fully.

    How do you use the Amazon tool to generate a link to the search results page? What do you put in the little box?

  34. Ian Beck says:

    Hey Tessa,

    Make sure you’re signed into your affiliate account, and visit the main site. There should be a gray bar across the top of the page (if it’s not visible, there should be a little gray stripe with an arrow in it at the top left corner; click it to open the bar). On the left side of the bar is a button that says “Link to this page.” All you have to do is navigate to the search page, click the “Link to this page” button, and Amazon should walk you through the rest.

  35. Tessa Green says:

    Aaaah (Very high pitched schriek)!!! Thank you so much. I’ve just spent 3 days trying to do that. Never spotted that grey stripe before. WOW! Thank you so so much.

    Tessa :))

  36. I landed here because I was so frustrated I google, ” hate Amazon new design affiliate program” and I really do.
    I agree with everyone, long ugly links, and it take forever to login, and get one darn link.
    Really annoying. I end up spending 30 minutes wading through all the menu’s , especially with their new design. HATE it. Just give me a link for goodness sake. They force you to constantly “walk” though pages to get to where you are going.
    Thanks for letting me vent!

  37. MrWebService says:

    Hi there – does anyone knoe if there’s any way to customise Amazon’s search widget? Or just create your own? It’s not as easy as appending your own ID ti the search query, is it?

    The search widgets Amazon provides don’t look great. I just want a straightforward search box.

    Hoping someone can help!!

  38. RRPF says:

    Does anyone know if it matters from the consumer side if the link is clicked on a site or typed in? Is it a no-no for me to add my favorite charity to the end of all links using this format?

  39. Ian Beck says:

    I don’t believe Amazon does any sort of referrer testing to verify the source of a link; as long as you aren’t the owner of the affiliate account, I doubt that they’ll care.

    I haven’t tested this myself, though. If you want a definitive answer you’ll probably need to ask Amazon support.

  40. Joey Day says:

    Have you heard of Amazon’s new shorter domain, You can now link to any product with a URL like so:

    It’s even shorter. Yay!

  41. Abseaz says:

    Thank you for sharing this very useful information with great explanations. I looked for a while and got conflicting answers before I found this article and was finally able to make sense of how the short link works (properly).

    My question is, does it make a difference if it’s “dp” or “gp” before the product code? Because on the official amazon blog (link you posted), they use “gp”, but you used “dp”. And is the difference between them anyway?

  42. Ian Beck says:

    Hey Abseaz,

    Glad the post was useful!

    I forget why I used /dp/ rather than /gp/. If I remember correctly, it was what was being used by Amazon’s actual URLs at the time, which I effectively just pared down to the shortest version possible.

  43. Abseaz says:

    Ahh, got it! Thanks for the quick reply.

  44. sun says:

    Thank you very much! I also was spending a half day while found your informative post!

    About /dp/ or /gp/.
    dp works ok (with my link) but gp instead creates 404!

    Amazon gives several different link formats on their blog and I too could not figure out exactly why they use dp, gp, b, etc…………
    I think it depends of their product categories or something like that.
    So everybody needs to check their new link before!

    Thanks to Joey Dey too!
    You rock guys!

  45. Keira James says:

    i have just signed up with the amazon affiliate program and i am still not earning a good deal of cash from them.-`.

  46. James says:

    I normally use this format

    so, this already short for me and work!

  47. Joey Day says:

    Oh, man. It gets even better. I just noticed (and this may be old news, but it was new to me) Amazon has introduced a link shortening system similar to TinyURL that hashes the ASIN into a slug only six characters in length. To get the tiny URL all you have to do is click on one of the share links, like the Twitter link. I’ve tested this and tacking your affiliate tag onto the end of the short link still works. So, to recap, the following links all do the same thing:

    Not shortened at all: (230 characters)

    Shortened according to directions in the original post: (52 characters)

    Shortened according to directions in my previous comment: (42 characters)

    Shortened according to directions in this comment: (37 characters)

  48. Sally says:

    I am trying to make a short link to an Amazon product with my affiliate link.
    I tried the examples above but it takes me to the wrong page of Amazon
    Here is the link I built for the Philips Norelco Arcitec which the ASIN # is -B000PKKAGO
    My link looks like this
    BUT it takes me to a kindle page??
    Any help would be appreciated – this is all new to me.
    Thank You!

  49. Nick says:

    “The shortest format you can use is”

    Actually, the shortest possible format is (one slash fewer).

    Do you know Amazon’s other associate endings like “-21” for Germany (

  50. Nick says:

    I would appreciate an answer. :-)

  51. Ian Beck says:

    No, I do not know whether Amazon’s associate endings for other countries end in different numbers. The best place to ask that would be Amazon Affiliate support or similar.

    If you were asking something else, please restate the question.

  52. Nick says:

    Thanks for your answer, Ian.

    I wasn’t asking whether Amazon’s other associate endings for other countries end in different numbers as I know they do. I was asking if you know what numbers the other associate endings are.

  53. Nick says:

    Thank you, anyway.

  54. Alexis says:

    Thank you for giving me a simple way out of the monstrosity of the amazon link!!!