Hack 72 Deep Linking to Amazon's Mobile Device Pages

figs/moderate.giffigs/hack72.gif

If you're developing an application for a mobile device, you can easily integrate with Amazon and collect referral fees in the process.

As the Internet expands beyond the world of desktop computers and browsers, Amazon is expanding as well by offering their services in a variety of alternate formats for alternate devices. They appropriately call these alternate formats Amazon Anywhere [Hack #7]. Of course these formats are also connected to the associates program, so you can collect referral fees by driving traffic to them.

Linking to Amazon Anywhere entry pages is straightforward, but linking directly to products or search results isn't as obvious. If you're developing a WAP application and want to link to an Amazon product for sale, or if you just want to browse directly to a product detail page like you can through Amazon's web site, it's a little tricky.

As with all Amazon URLs, once you know the pattern you can change the variables to get what you need. The base URL for Amazon Anywhere links contains four unchanging variables:

tag

Your Amazon associate tag [in Section 5.2 ]

creative

Your developer's token Section 6.4

camp

Always set to 2025

link-code

Always set to xm2

So the base URL for any link will always contain these variables:

http://www.amazon.com/exec/obidos/redirect?tag=insert associate tag[RETURN]
&creative=insert developer token&camp=2025&link_code=xm2

The fifth variable, path, holds all the information about what format and what information you'd like. Here are the formats available:

PDA

This is a stripped-down HTML that's suitable for lower-bandwidth devices with small screens.

RIM Blackberry

Similar to the PDA, this has a slightly different layout and uses strict XHTML.

WAP

WML (Wireless Markup Language) pages formatted for cell phones.

HDML

An older cousin of WML, HDML is a non-XML-compliant version. Some older devices that don't support WML can handle only HDML.

VoiceXML

A format that allows computer-driven phone interaction.

In any of these formats, you can link directly to product detail pages with an ASIN, or search results pages with a keyword. The path values are shown below.

72.1 Product Detail Paths

Here are the potential path values for the various URL formats, which should be added to the base URL:

  • PDA: dt/upda-1.0-anywhere/tg/aa/upda/item/-/insert ASIN

  • RIM: dt/upda-1.0-i/tg/aa/upda/item/-/insert ASIN

  • WAP: ct/text/vnd.wap.wml/-/tg/aa/xml/glance-xml/-/insert ASIN

  • HDML: ct/text/x-hdml/-/tg/aa/hdml/item/-/insert ASIN

  • VoiceXML: dt/vxml/tg/aa/xml/glance-xml/-/insert ASIN

72.2 Search Results Paths

And here are the potential path values for search results:

  • WAP: ct/text/vnd.wap.wml/-/tg/aa/xml/search/-/books/keyword/1/

  • HDML: ct/text/x-hdml/-/tg/aa/hdml/search/-/books/keyword

  • VoiceXML: dt/vxml/tg/aa/xml/search/-/books/keyword/1/

Search results pages are slightly different for PDA and RIM Blackberry devices. See the following examples to learn how they're done.

72.3 Assembling the URLs

Putting the URLs together is now just a matter of assembling the pieces based on the desired format and information. Take the base URL and add either the product detail or search results section for the needed format. For example, here's a WAP product detail page URL:

http://www.amazon.com/exec/obidos/redirect?tag=insert affiliate tag [RETURN]
&creative=insert developer token &camp=2025&link_code=xm2[RETURN]
&path= ct/text/vnd.wap.wml/-/tg/aa/xml/glance-xml/-/0596004478 

And here's a VoiceXML search result URL:

http://www.amazon.com/exec/obidos/redirect?tag=insert affiliate tag [RETURN]
&creative=insert developer token &camp=2025&link_code=xm2[RETURN]
&path= dt/vxml/tg/aa/xml/search/-/books/hacks /1/

Keyword search result URLs for PDA and RIM Blackberry devices have a different format, but the concepts are the same. Just replace the keyword, developer token, and affiliate tag with the proper information.

  • PDA:

    http://www.amazon.com/exec/obidos/dt/upda=1.0-pocketpc /search-handle-url[RETURN]
    ?tag=insert affiliate
    tag &creative=insert developer token [RETURN]
    &camp=2025&index=books&page=1&size=6&ss=1&file=aa/upda/upda-other[RETURN]
    &field-keywords=insert keyword &method=GET
  • RIM:

    http://www.amazon.com/exec/obidos/dt/upda=1.0-i /search-handle-url[RETURN]
    ?tag=insert affiliate tag &creative=insert developertoken &camp=2025[RETURN]
    &index=books&page=1&size=6&ss=1&file=aa/upda/upda-other[RETURN]
    &field-keywords=insert keyword &method=GET

If you'll be placing these URLs inside a WML or XSL file, replace the ampersands with %26 so the document will be valid XML.

These definitely aren't the kind of URLs you want to key into your phone. But if you're building a site for a mobile device, you can link directly to Amazon and earn referral fees in the process.