Amazon Affiliate Linker shortcut
Use Apple Shortcuts to clean up long Amazon item URLs and apply your Affiliate ID.
This shortcut takes an Amazon item URL, strips out unnecessary parameters and trackers, and applies an Amazon Affiliate tag to the end. Then you can choose what to do with the reformated URL.
As part of the first setup, it will ask for your Amazon Affiliate ID. If you don’t have one, you can create one at here. Or feel free to use mine. 😉 You can always change the ID later by replacing the text in the first ‘Text’ action.
The origin and methodology of this shortcut are documented in this blog post.
See It in Action
Run This Shortcut
You can run this shortcut from its URL (such as from within a note, calendar event, or to-do item):
shortcuts://run-shortcut?name=Amazon%20Affiliate%20Linker
Latest Release Notes
Version 1.5 — 2024-10-04
- Simplified actions to use a regular expression to match the ASIN, which should also be more accurate.
- Clarified how the starting URL is gotten.
- Cleaned up the final built URL.
- When opening the final URL, it also copies it to the clipboard.
- Tested for macOS Sequoia and iOS 18.
- Download version 1.5
Version History
Version 1.4 - July 15, 2023, 11:30pm
- Updated the Description and About comments to match the new Library style.
- Removed
smile.amazon.com
bits since Amazon Smile is no longer a thing. - Clarified which actions are part of the Setup Stuff.
- Cleaned up and clarified some ‘Comment’ actions to explain what’s happening in different sections of the shortcut.
Version 1.3 - Nov. 28, 2021, 10:00pm
- Fixed the Copy menu option to correctly copy the Final URL text to the clipboard on both Mac and iOS/iPadOS.
- Download version 1.3
Verison 1.2
- Added a Replace Text action that normalizes an Amazon URL that uses the “/gp/product/“ format before reformatting. This should help with the “index 0” issue when the ASIN doesn’t directly follow “gp” in the original URL.
- Note: I’ve noticed that sometimes the final menu option to copy the final URL doesn’t correctly get the link onto the clipboard. From what I understand, this is a known bug in Shortcuts for iOS 15. When I run into that issue, I typically rerun the shortcut, and then Share instead at the end, and use the Copy action in the Share Sheet.
- Download version 1.2
Version 1.1
- Fixed an incorrect character in the final URL build (&tag instead of ?tag).
- Added RoutineHub URL to opening comment block so you can find where to get the latest version.
- Added a check to see if the input URL is an Amazon link, and returns an error message and stops if it is not.
- Download version 1.1
Version 1.0
- Introducing Amazon Affiliate Linker v1.0
- Download version 1.0
Thanks for checking out this shortcut! It’s part of the HeyDingus Shortcuts Library. If you’re sharing my shortcuts or modifying them (or see a bug or have a feature request), I’d love to hear from you — please give me a shout! And maybe consider a donation if you find this shortcut fun or useful. Thank you. ✌️