How to Auto-Remove Annoying Tracking Codes in URLs You Share from Your iPhone to Get Cleaner Links

Mar 2, 2021 06:26 PM
Mar 2, 2021 06:42 PM
637501492237943601.jpg

URL tracking codes: you'll see them on almost every link you copy online to share with friends and followers. It could be tens or hundreds of extra characters appended to the end of a URL, which websites and marketers use to tell how you got to the link in the first place. These excess tracking tokens not only make the links you share look sloppy and spammy — they could even invade your privacy.

The Problem with URL Tracking Codes

Tracking codes could be unique to each website for their own internal purposes, or they could be Urchin Tracking Module (UTM) parameters. Many sites and marketers use the latter, which could include sensitive information such as which website or app referred you to the URL, which search terms you used to get there, and whether you landed on the page from an email, newsletter, social site, app, ad, etc.

From a privacy-perspective, you may not want your family, friends, and followers you share a link with to know how you found the webpage. For instance, I'm sure you don't want anybody knowing that you visit adult websites, dating apps, and other embarrassing places — all of which is data that can be tagged to the end of a shared URL in a sea of confusing text and numbers that's easy to overlook.

Cleaning Up Links for Sharing

You could manually delete all of the extra letters, numbers, and special characters in the URL before you share the link, but why do that when you can automate the removal? Also, there's always the chance that you could trim one too many characters from the URL, which would cause a broken link to a dead webpage. To help clean the clutter from these annoying links, use a simple shortcut instead.

The "Cleanup URL" shortcut for iOS and iPadOS trims the bloat for you, removing most tracking codes tacked to the end of URLs you share.

Best of all, this shortcut also cleans up Google AMP links, which are meant to speed up your experience on the web. These accelerated mobile pages are cached to load faster and be viewed right in Google Search. You can even swipe through stories about the subject from other sites without ever leaving Google Search. With AMP links, the extra stuff added to the URL comes before, not after, so you'll see all of those links start with google.com/amp/s.

Required

  • iOS 14: The "Generate Password" shortcut was created and optimized for iOS 14 and has not been tested on iOS 13.
  • Shortcuts: If you've deleted the Shortcuts app, re-install it from the App Store.
  • Allow untrusted shortcuts: To add user-created shortcuts to your library, go to Settings –> Shortcuts, then toggle on "Allow Untrusted Shortcuts."

Adding the 'Cleanup URL' Shortcut

The "Cleanup URL" shortcut, created by Redditor sharp-guru, can be installed using the direct iCloud link below or from their Reddit post.

You should be redirected to Shortcuts to preview the workflow, but tap "Get Shortcut" if you're not. To add the shortcut to your library, scroll through the shortcut's actions and tap the red "Add Untrusted Shortcut" button at the bottom.

637501202514073474.jpg
637501202663760507.jpg
637501202514073474.jpg
637501202663760507.jpg

Using 'Cleanup URL' to Shorten URLs

Once the shortcut is added to your "My Shortcuts" library, it's all ready to be used in Safari, third-party browsers, other types of apps, and other places that have sharing options. As long as the content you're sharing is a URL, it should work.

Example 1: Cleaning Up Links from Reddit

First, we'll try cleaning up a link for a Reddit post copied from within the official Reddit app. Normally, when you share or copy a Reddit post from this app, the tokens will say that you did so from its iOS app using the Share button, along with a campaign ID.

This time, when you "Share" a Reddit post or link, don't use "Copy Link" or select an app to share it to — scroll down and tap the "Cleanup URL" shortcut instead.

637501217380600114.jpg
637501217676693942.jpg
637501218057788056.jpg
637501217380600114.jpg
637501217676693942.jpg
637501218057788056.jpg

At the top of the screen, you'll see a notification showing you the cleaned-up URL, which automatically goes to your clipboard so you can easily paste it elsewhere. Hit "Done," and you're good to go. Below, you can see the de-cluttered URL versus the original URL. Doesn't that look much better?

637501218286849615.jpg
637501218657787575.jpg
637501218286849615.jpg
637501218657787575.jpg

Example 2: Cleaning Up AMP Links from Google

Now, let's try converting a Google AMP link to the actual webpage's URL.

To find a Google AMP link, google anything newsworthy in a web browser like Microsoft Edge, but make sure Google is your search engine. Then, tap on any of the articles suggested to you near the top of the results, which will be cards from popular websites such as CNN, Fox News, People, TMZ, etc.

In the search bar, you'll see that the URL for the webpage starts with google.com. Now, not all browsers work the same in regards to Google AMP links.

If you use the Share button from the toolbar or AMP bar in Safari, Chrome, or Brave, it will remove the google.com part automatically. Browsers like Firefox load the real article from AMP cards, so it doesn't even matter here. However, browsers like Edge will use the google.com link when using the Share button from its toolbar.

If that's you, instead of tapping on "Copy" or sharing to another app, scroll down and tap the "Cleanup URL" shortcut.

637502702730010863.jpg
637502702966417076.jpg
637502703212198007.jpg
637502702730010863.jpg
637502702966417076.jpg
637502703212198007.jpg

Once again, a preview of the cleaned link will appear, and it'll be copied to your clipboard. Below, you can see the difference between the two links.

637502703474072558.jpg
637502703639385633.jpg
637502703474072558.jpg
637502703639385633.jpg

Removing the 'Done' Notification

If you want to streamline this shortcut so that you don't have to tap "Done" every time a URL is copied with Cleanup URL, you can edit its workflow. In the "My Shortcuts" tab in Shortcuts, tap the ellipsis (•••) icon on the "Cleanup URL" card. Scroll to the end of the workflow, then delete the "Text" action that has the notification text in it, as well as the "Previewing" action that says "Show Text" below it. Hit "Done," and you won't have to deal with that extra step anymore.

637502718609854857.jpg
637502718953764295.jpg
637502718609854857.jpg
637502718953764295.jpg

While you can disable some other Shortcuts notifications, such as for automations, you cannot also get rid of the notification with a checkmark in it, which lets you know that the shortcut worked. So even after getting rid of the "Done" alert, you'll still see a notification, but it'll be only for a second.

Enhancing the 'Cleanup URL' Shortcut

If you find that Cleanup URL is not good enough since it only looks for UTM codes and Google AMP links, you can expand it to look for any type of tracking information after the main URL.

If you go back into the editor for the shortcut, go to the "Documents" action that starts with "Replace." Then, replace the regular expression there with the one below. This removes the UTM parameters so that it deletes everything after a ? or & or # or = symbol, as well as AMP content.

\?[^?]*|\#[^#]*|\&[^&]*|\=[^=]*|(www.google.*\/amp\/s\/|\/amp)

Obviously, this can break links for websites that used those four symbols in their base URL structure, but you can tweak the expression to fit what works for you. A good tool to use to create and test expressions is Regex101.

637502769406417004.jpg
637502771277042544.jpg
637502769406417004.jpg
637502771277042544.jpg

'Cleanup URL' Isn't Perfect

It's important to note that Cleanup URL doesn't work perfectly every time. For certain URLs, the shortcut is only able to wipe out a section of the tracking codes. The more you try it out, the better picture you'll have on how it works and whether it's worth running the shortcut and removing only some part of the tracking codes. Either way, "Cleanup URL" can at least make the URLs with tracking codes shorter.

However, some tracking codes are impossible to clean up.

For example, whenever I try to share a story in an email from the Los Angeles Public Library, the tracking link will look the same as the Cleanup URL link. That's because the LAPL uses a marketing platform that completely hides the real URL so that there's nothing to clean up. The real URL is completely unretrievable unless you open the link, being buried behind Base64 code structure.

laplca.patronpoint.com/r/4c62d0c9606cfbeac86459d8e?ct=YTo1OntzOjY6InNvdXJjZSI7YToyOntpOjA7czo1OiJlbWFpbCI7aToxO2k6MzY7fXM6NToiZW1haWwiO2k6MzY7czo0OiJzdGF0IjtzOjIyOiI2MDNkN2E0MWYzMTYwMDQwOTg1MTg1IjtzOjQ6ImxlYWQiO3M6NjoiMjU0NDgzIjtzOjc6ImNoYW5uZWwiO2E6MTp7czo1OiJlbWFpbCI7aTozNjt9fQ%3D%3D&

After decoding the Base64, it looks like the following, which is data only readable by the platform that does the rerouting to the story's real URL.

laplca.patronpoint.com/r/4c62d0c9606cfbeac86459d8e?ct=a:5 :{s:6:"source";a:2:{i:0;s:5:"email";i:1;i:36;}s:5:"email";i:36;s:4:"stat";s:22:"603d7a41f3160040985185";s:4:"lead";s:6:"254483";s:7:"channel";a:1:{s:5:"email";i:36;}}

The real story URL that I was trying to get to looks like this:

lapl.org/womens-history

However, if you're using the alternative regular expression above, it'll delete everything after the ? mark. In this case, all of the Base64 deleted is tracking information and isn't needed; the link to the article itself is the random group of letters and numbers that came before it. So, this will actually create a cleaner link, but it won't get you the real URL. Still, it's better than nothing.

laplca.patronpoint.com/r/4c62d0c9606cfbeac86459d8e

Cleanup URL can't perform magic, but it can get rid of most of the tracking codes whenever the original URL is actually in the URL you're trying to clean up.

Cover photo and screenshots by Nelson Aguilar/Gadget Hacks

Comments

No Comments Exist

Be the first, drop a comment!