← Back to Blog

Clean Copy: Stripping Tracking Parameters from URLs with iOS Shortcuts

Build an iOS Shortcut to automatically remove UTM parameters and other tracking garbage from URLs. Share clean links without the surveillance baggage.

By John Croucher
iOSShortcutsPrivacyAutomationTutorial

Every URL you share these days comes with a tracking tail longer than a CVS receipt.

Copy a link from Facebook? Enjoy your ?fbclid=. From Twitter? Here’s your utm_source=twitter. From literally anywhere? Have some mc_cid, mc_eid, gclid, and maybe throw in a _hsenc for good measure.

These tracking parameters don’t just make URLs ugly. They:

  • Break link deduplication (same article, different tracking = “different” links)
  • Expose your browsing patterns to analytics platforms
  • Make URLs impossible to read
  • Sometimes break when shared (looking at you, AMP links)

Here’s how to build an iOS Shortcut that strips all that tracking garbage automatically.

What We’re Building

An iOS Shortcut that:

  1. Receives URLs from the Share Sheet (or Shortcut Input)
  2. Strips out common tracking parameters
  3. Returns a clean URL to your clipboard

The screenshot you shared shows the core logic. Let me break down how to build it.

The Shortcut Components

1. Receive Input

First, we need to accept URLs from wherever you’re sharing from:

Receive [Apps and 5 more] from Share Sheet

This makes the shortcut appear in the Share Sheet across iOS. You can select which apps it appears in, or just select “Safari” and “Apps” for maximum compatibility.

Important: Add the fallback:

If there's no input:
  Continue

This allows the shortcut to work even when called directly (it’ll grab from clipboard instead).

2. Get the First Item

Get First Item from Shortcut Input

URLs can come in as arrays (especially from some apps). We just want the first one.

3. The Magic: Regex Replacement

This is where the tracking parameters get nuked:

Replace (\?|&)(utm_[^&]+|fbclid|gclid|mc_cid|mc_eid|link_source|taid)=[^&]+
with [World]
in [Item from List]

Let me break down this regex pattern because it’s doing a lot:

(\?|&) - Match either ? or &

  • The ? starts a query string
  • The & separates parameters

(utm_[^&]+|fbclid|...) - Match tracking parameter names

  • utm_[^&]+ catches ALL UTM parameters (utm_source, utm_medium, utm_campaign, etc.)
  • The other values are specific tracking IDs:
    • fbclid - Facebook Click Identifier
    • gclid - Google Click Identifier
    • mc_cid - Mailchimp Campaign ID
    • mc_eid - Mailchimp Email ID
    • link_source - Various platforms use this
    • taid - Twitter Ad ID

=[^&]+ - Match the equals sign and the value

  • = is the separator
  • [^&]+ means “one or more characters that aren’t &” (the parameter value)

What This Catches

Given this URL:

https://example.com/article?utm_source=twitter&utm_medium=social&fbclid=ABC123&important=keep

The regex matches:

  • ?utm_source=twitter
  • &utm_medium=social
  • &fbclid=ABC123

But NOT:

  • &important=keep (not a tracking parameter)

4. Copy to Clipboard

Copy [Updated Text] to clipboard

The clean URL gets copied, ready to paste anywhere.

Building It Step by Step

Step 1: Create New Shortcut

  1. Open the Shortcuts app
  2. Tap the + button
  3. Name it “Clean Copy” (or whatever you want)

Step 2: Add Receive Action

  1. Search for “Receive”
  2. Add “Receive from Share Sheet”
  3. Tap “Apps and Websites” and select where you want it available
  4. I recommend: Safari, Chrome, Twitter, Facebook, Messages

Step 3: Add Fallback

  1. Search for “If”
  2. Add “If” action
  3. Set condition to: “Shortcut Input” “has any value”
  4. In the “Otherwise” section, add “Continue”

This isn’t strictly necessary but makes the shortcut more robust.

Step 4: Get First Item

  1. Search for “Get First Item”
  2. Add it
  3. Set input to “Shortcut Input”

Step 5: Add the Regex Replace

  1. Search for “Replace Text”
  2. Add “Replace Text”
  3. Tap “Regular Expression” to enable regex mode
  4. In the pattern field, paste:
(\?|&)(utm_[^&]+|fbclid|gclid|mc_cid|mc_eid|link_source|taid)=[^&]+
  1. Leave the replacement field EMPTY (or add a single space)
  2. Set it to replace in “Item from List”

Critical: Make sure “Regular Expression” is enabled. Otherwise it’ll try to literally match the pattern.

Step 6: Clean Up Multiple & Symbols

The regex might leave you with && or ?& in some cases. Add another Replace Text:

  1. Add another “Replace Text”
  2. Pattern: (\?|&)&+ (regex enabled)
  3. Replace with: ? (or & depending on preference)

Actually, scratch that. The simpler approach is to add this pattern to your main regex or just accept the occasional ?& - browsers handle it fine.

Step 7: Copy to Clipboard

  1. Search for “Copy”
  2. Add “Copy to Clipboard”
  3. Set input to the output from your Replace Text

Step 8: (Optional) Show Notification

Add a “Show Notification” action with:

Clean URL copied

So you get feedback that it worked.

The Complete Flow

1. Receive [Apps] from Share Sheet
   If there's no input: Continue

2. Get First Item from Shortcut Input

3. Replace Text (regex enabled)
   Pattern: (\?|&)(utm_[^&]+|fbclid|gclid|mc_cid|mc_eid|link_source|taid)=[^&]+
   Replace with: (empty)
   In: Item from List

4. Copy to Clipboard

5. Show Notification: "Clean URL copied"

Using It

From the Share Sheet

  1. Find a link-infested URL (they’re everywhere)
  2. Tap the Share button
  3. Find “Clean Copy” in the actions
  4. The clean URL is now in your clipboard

From the Shortcuts App

  1. Copy any URL
  2. Run the “Clean Copy” shortcut
  3. The clean URL replaces it in your clipboard

Extending It

Add More Tracking Parameters

The beauty of utm_[^&]+ is it catches all UTM variants. But you can add more specific trackers:

Common ones to add:

  • _hsenc - HubSpot encryption parameter
  • _hsmi - HubSpot message ID
  • mkt_tok - Marketo token
  • rb_clickid - Rakuten
  • vero_id - Vero email tracking
  • wickedid - Wicked Reports
  • yclid - Yandex Click ID

Updated pattern:

(\?|&)(utm_[^&]+|fbclid|gclid|mc_cid|mc_eid|link_source|taid|_hsenc|_hsmi|mkt_tok|rb_clickid|vero_id|wickedid|yclid)=[^&]+

Google AMP links are another tracking nightmare. Add this as a separate Replace Text action:

Pattern: ^https://www\.google\..*/amp/s/(.*)
Replace with: https://$1

This converts:

https://www.google.com/amp/s/example.com/article

To:

https://example.com/article

Handle Amazon Tracking

Amazon URLs are particularly heinous:

https://www.amazon.com/product/B08XYZ?ref=sr_1_1&pd_rd_r=abc&psc=1

You only need the product ID (the B08XYZ part). Add:

Pattern: (amazon\.[^/]+/[^/]+/)([^/]+)/.*
Replace with: $1$2

Though honestly, Amazon links are complex enough they might warrant a separate shortcut.

Why This Matters

Privacy: Tracking parameters tell advertisers exactly where you found a link, when you clicked it, and sometimes who you are.

Cleanliness: Compare:

https://example.com/article?utm_source=twitter&utm_medium=social&utm_campaign=spring2026&fbclid=IwAR0abcdefghijklmnop

To:

https://example.com/article

One is readable. One is surveillance.

Link Rot Prevention: Tracking parameters sometimes expire or break. Clean URLs are more stable.

The Regex Explained (For Non-Regex People)

If you’ve never used regular expressions, they look like line noise. Here’s the pattern broken down:

(\?|&)(utm_[^&]+|fbclid|gclid|mc_cid|mc_eid|link_source|taid)=[^&]+

Think of it as:

  1. Find either a ? or & character
  2. Followed by one of these tracking parameter names
  3. Followed by an = sign
  4. Followed by the parameter’s value (everything until the next &)

The pattern matches the entire tracking parameter (name + value) so it can be deleted.

Testing Your Regex

Before putting it in a Shortcut, test it at regex101.com:

  1. Select “JavaScript” flavor (close enough to iOS)
  2. Paste your pattern
  3. Paste test URLs
  4. See what gets matched (highlighted)

Example test URL:

https://example.com/article?utm_source=facebook&utm_medium=social&fbclid=ABC123&important=keep&utm_campaign=test

Should match everything except important=keep.

Common Issues

”It’s Not Removing All Parameters”

Make sure:

  1. Regular Expression mode is enabled in Replace Text
  2. You’re using the right pattern (copy-paste to avoid typos)
  3. The parameter you want removed is in the list

”It’s Breaking URLs”

Check if you’re accidentally removing non-tracking parameters. The pattern should ONLY match known trackers.

If a site uses utm_content for actual content routing (rare but possible), you might need to remove that from the pattern.

”The Share Sheet Shows It Twice”

iOS sometimes duplicates shortcuts. Delete one of them:

  1. Open Shortcuts
  2. Find the duplicate
  3. Delete it
  4. Restart Shortcuts app

Production-Ready Version

Here’s the pattern I actually use daily, with 30+ tracking parameters:

(\?|&)(utm_[^&]+|fbclid|gclid|mc_cid|mc_eid|_hsenc|_hsmi|link_source|taid|mkt_tok|rb_clickid|vero_id|wickedid|yclid|msclkid|igshid|ref_?|pd_rd_[^&]+|psc|sr_|qid|keywords|sprefix|tag|camp|creative|linkCode|linkId|cv_ct_|ncid|NID|ICID|CMP|soc_src|soc_trk|source)=[^&]+

That’s probably 90% of tracking parameters in the wild.

Alternatives

Browser Extensions

If you’re on desktop, browser extensions like:

  • ClearURLs (Firefox, Chrome)
  • Neat URL (Firefox, Chrome)
  • Link Cleaner (Safari)

Do this automatically. But mobile Safari doesn’t have extension support, hence the Shortcut.

URL Cleaner Apps

Apps exist for this, but why install a whole app when Shortcuts is built-in?

Manual Editing

You could manually delete parameters from URLs. But you’ll forget, get lazy, or miss some.

Automation wins.

Conclusion

This Shortcut takes 2 minutes to build and saves you from sharing surveillance URLs forever.

Every cleaned URL is one less data point for the tracking industrial complex.

Plus, clean URLs just look better.

Build it once, use it daily, share links like a civilized human.


Want to go deeper? I’ve built production automation systems that make this Shortcut look trivial. Let’s talk about automating your workflow.


This technique works on iOS 15+ and iPadOS 15+. The Shortcuts app is free and built-in. No subscriptions, no tracking (ironically), just cleaner URLs.