⌘ January 26, 2022

Search Better with Keyword Search and Shortcuts

A few months back, I created a shortcut that lets me quickly and easily take any Amazon product URL and format it into a clean link with my affiliate tag attached. Since this site is a hobby with ongoing costs, I count it as a win whenever I can get a few pennies back for products that I recommend and y’all purchase.

As a side effect of the shortcut making it so simple to open any page with the affiliate link, I’ve started using it when I purchase things myself. It may not be in the spirit of the affiliate program, and perhaps I’m shooting myself in the foot by writing about it here, but it’s a fun experiment.

But something was nagging at the back of my head. My understanding is that the affiliate link is only effective if it’s the one that opens your browsing session. So, if I’m searching around for an item, find it, and then reopen the page with the affiliate tag, does it still work? That led me to wonder if I could build the tag right into my quick searches.

Fortunately, the Amazon Affiliate website offers built-in functionality to attach your affiliate link to a particular search. By deconstructing the resulting URL, I was able to identify where the search term goes, hardcode in the Amazon Smile domain, and remove the additional tracking parameters that Amazon includes by default.

Here’s the final search URL, in which @@@” is replaced with the search term, and ###” is replaced with the Affiliate ID:

https://smile.amazon.com/s?k=@@@&tag=###

Since I have the excellent (and free) Keyword Search Safari extension installed on all my devices, setting up a custom search was trivial. This app lets you create custom searches for nearly any site using an abbreviation that you define. I just added a new item with az” as the keyword and https://smile.amazon.com/s?k=@@@&tag=heydingusnet-20 as the expansion. And I only had to add it once since Keyword Search syncs automatically across its installations.

A screenshot showing how to add a new entry into Keyword Search.
Adding a new customer search is as easy as coming up with an abbreviation and pasting in a URL with the right format.

All I need to do to open an Amazon search page with my affiliate link included is to prepend az” to my search query. I can do this directly from Safari’s Address Bar or Spotlight on iPhone, iPad, and Mac. I typically use Alfred as a Spotlight replacement on the Mac, and it works there, too.

Screenshots of searching from Spotlight on iOS and macOS.
Searching with az” prepended to the term in Spotlight, both on iOS and macOS, will open directly to Amazon’s website.

Now, any Amazon search that I start from my Mac, iPhone, or iPad always opens to Amazon Smile, includes my affiliate tag, and doesn’t include any other grossness from the end of the URL. You can, of course, change the Affiliate ID to any you want (or keep mine if you’d like to support this site 😉). And if all you want is quick access to a clean Amazon search, you’re welcome to remove everything after the @@@”.

If you haven’t tried Keyword Search before, I highly recommend it. It’s a far faster way to find something from a specific domain or search engine on the web.

Examples of my Keyword Search items.
I’ve got a bunch of Keyword Search items set up and use them daily.

Bonus: Search Menu shortcut

I couldn’t let you go without including something for Shortcuts. Ever since I installed Keyword Search, my Share Menu’ shortcut gets less use these days, but I used to run it all the time. Say you have a shortlist of places that you search regularly. For example, YouTube, Twitter, HeyDingus, Apple Maps, and Amazon. This shortcut asks for a search term and then presents a menu of just those places that you’ve defined. Tap one, and you’re brought directly to the search results. There is no need to locate the app on your device, then navigate to its search view, and then finally type in the term to search for the results.

It works with search engines built into the Search Web’ shortcuts action and any URL you construct, like the one above. And, if an app on your device provides a search action, you can add those in, too (e.g., Maps or Reeder). (You’ll also find in it a teaser for another shortcut that will be published on HeyDingus soon!)

A screenshot showing the actions that configure the search locations in ‘Search Menu’.
Depending on whether the destination is a website or an app, the searching actions can vary, but they all rely on the searchTerm’ variable.

Search Menu’ works well as a widget, as a standalone icon on your Home Screen, or in other launchers. It’s also compatible with the Mac, as long as the corresponding apps are also installed there.

A screenshot of the ‘Search Menu’ shortcut in action, searching for “studio neat”.
‘Search Menu’ runs great on macOS.

Get the Search Menu’ shortcut → Original Version | Latest Version

Shortcuts Tips


❮ Previous post

The Case for Using Ultra Wideband for Lossless and More January 25, 2022

Next post ❯

‘Wordle May Be Fixed, but the App Store Is Still a Total Mess’ January 26, 2022