Conversions & Utilities

Clean Tracking Link

Remove common marketing trackers from a selected URL.

OfficialOn-device

Download action

What Clean Tracking Link does

Removes UTM parameters and well-known click identifiers while preserving unrelated query parameters, their encoding, and the URL fragment.

CategoryConversions & Utilities
Action typeJavaScript
ResultReplace or copy text
InternetNot required

Action and outcome

Clean Tracking Link example
ActionOutcome
Clean Tracking LinkSelected text: https://example.com/article?id=42&utm_source=newsletter&fbclid=abc#noteshttps://example.com/article?id=42#notes

Use Clean Tracking Link

Follow these steps to remove common marketing trackers from a selected URL with ActionClip.

  1. Select the text you want to use.
  2. Choose Clean Tracking Link from ActionClip.
  3. Review the result, then replace the selection or copy the new text.

Requirements and privacy

  • Before you start: No setup required.
  • Your selected text: Runs locally in ActionClip’s JavaScript sandbox. Selected text does not leave your Mac.

Action configuration

The definition below is included so you can inspect how the action works before downloading it.

JavaScript definition
function run(selected_text) {
  const input = selected_text.trim();
  const match = input.match(/^(https?):\/\/([^/?#\s]+)([^?#]*)(\?[^#]*)?(#.*)?$/i);
  if (!match) throw new Error("Select one complete HTTP or HTTPS URL.");

  const blocked = new Set([
    "fbclid", "gclid", "dclid", "msclkid", "mc_cid", "mc_eid", "igshid",
    "vero_id", "_hsenc", "_hsmi", "mkt_tok", "oly_anon_id", "oly_enc_id"
  ]);
  const query = (match[4] || "").replace(/^\?/, "");
  const kept = query ? query.split("&").filter((entry) => {
    if (!entry) return false;
    const rawKey = entry.split("=", 1)[0].replace(/\+/g, " ");
    let key;
    try { key = decodeURIComponent(rawKey).toLowerCase(); }
    catch (_) { key = rawKey.toLowerCase(); }
    return !key.startsWith("utm_") && !blocked.has(key);
  }) : [];

  return match[1].toLowerCase() + "://" + match[2] + (match[3] || "")
    + (kept.length ? "?" + kept.join("&") : "") + (match[5] || "");
}