Another small Amazon thing

A brief followup to my last post.

Let’s say you’re using your iPhone or iPad and want an Amazon Associates link to the item you’re looking at in Safari. You don’t want to assemble a bunch of text about the product—the link itself is enough. There’s no need to mess around with the Amazon Product Advertising API, you can just use the regex matching that’s built into Shortcuts to extract the product’s ASIN from the page’s URL and use it to make a new link with your affiliate tag. Like this:

Amazon Associates shortcut

You will, of course, have to edit the second-to-last step, replacing “my-tag” with whatever your Amazon tag is.

This shortcut is meant to be used from the Share Sheet. When it’s run, it pulls the product ASIN (that’s Amazon’s product ID string) from the URL of the page you’re looking at and generates a new URL (usually simpler than the original) with your affiliate tag appended to the end. The new URL is then put on the clipboard, ready to be pasted wherever you need it.

I wouldn’t be surprised to find that Amazon has more ways to put the ASIN into a URL than the three that are covered by my regex. But this regex has always worked for me and can be extended if you find another format.