An Automatic URL Decrufter for Defined Hosts

A while back, a friend and I were discussing the amount of cruft in many URLs. As an example, here's a URL from a recent Monoprice email newsletter. Note: I changed a few of the characters so these URLs will not work; they're for demonstration purposes only.

If you load that in your browser, here's what you'll see in the URL bar:

But everything after the "p_id..." bit is simply tracking information; this is the actual URL:

You may not wish to share all that tracking information with companies every time you click one of their URLs. Enter the URL Decrufter, which works whenever you copy a URL—it checks the domain to see if it's one you want to decruft, and if so, cleans it up and opens it in your browser (and puts it on the clipboard).

I posted a very rough version of this a couple weeks back, but it's now a much more refined solution (up to version five now), and ready to use without any required editing. Here's the full macro, along with the various sub-macros I use (for ease of maintenance and readability, mainly): (20.7 KB)

The thing may look intimidating, but much of what's there are just simple sub-macros to do one thing. As a result, the main macro is basically just a bunch of calls to other macros. (I've tested, and there's a barely-measurable difference in execution time when done this way.)

Macro steps that contain areas you may have to (or want to) edit are colored green, comments are marked in yellow, and I clear all the variables that are used after each run with one exception—there's now a history variable that I use to keep track of previously-cleaned URLs, so they're not cleaned again if you copy them (say from your browser's URL bar) in the future.

There's now a complete (if basic) set of instructions in the main macro, and this version will "just work" out of the box—you should only need to edit to add domains to filter, which can either be really simple (one word added to one macro) or much tougher—see the instructions for more details.

I'd love your feedback, and if you have domains that you'd like to see filtered, feel free to contact me with the copied URL and I'll try to get them in the macro.