A Greasemonkey/Tampermonkey userscript that strips tracking and redirect parameters from URLs on shopping, search, and social sites — both the address in your browser bar and the links on the page.
- Install / listing: GreasyFork
- Issues / PRs: GitHub
- Forked from beck's General URL Cleaner.
- More reliable: a single unusual link (a Disqus profile link, a Google link with no destination) can no longer stop the script from cleaning the rest of the page.
- Single-page sites: the address bar is cleaned again when you move between pages without a full reload (YouTube, and other sites in browsers that support it), not just on the first load.
- Google
/url?q=links are now unwrapped to their real destination. - Safer redirects: only real web addresses (
http/https) are ever used as a redirect target, and the Back button no longer bounces you through redirect pages. - Fewer side effects: keeps the
#sectionpart of the address and the site's own navigation state, no longer overrides sites' own handlers, and no longer runs on look-alike domains such asnotgoogle.com. - Fixed Amazon
/gp/productlinks without a product ID turning into/gp/productnull.
- YouTube
ppstripped: theppplayer-parameters tracking blob is now removed from YouTube links. - Original link form preserved: empty (
href="") and hash-only (#) links are left untouched, and relative links stay relative instead of being expanded to absolute URLs — so the script no longer conflicts with other extensions that match on relative link paths.
- Scoped to supported sites only: the script now runs only on the sites listed below. 5.0 ran on every website, which could interfere with unrelated pages.
- Amazon order pages fixed: "View Order" / order-details links keep their
orderIDquery intact instead of having it mangled. - Generic trackers stripped everywhere:
utm_*and common click-ID parameters (gclid,fbclid,msclkid, etc.) are now removed on all supported sites — both the page URL and the links — not just the few that routed through the generic cleaner before.
A major release built up across many fixes, new site coverage, and an engine rewrite.
- New site support: Bing, Audible, LinkedIn, Etsy, Yahoo, Spotify, Reddit, Twitch, Threads, AliExpress, Walmart, Best Buy, and TikTok.
- Cleaning fixes: Google (
sclient/ping/authuser), eBay, Amazon (/dp/and/gp/product/), Disqus, Facebook, and a long-standing trailing-ampersand bug. - SPA-aware: link cleaning now follows in-page navigation via
hashchangeand aMutationObserver, and skips injection in subframes (except the Disqus embed) for less overhead. - Engine rewrite: uniform sites fold into one data-driven table; the per-site cleaners and redirect decoders are now unit-tested under CI (Node's built-in test runner).
- Removed: Twitter and Pocket handling (sites changed; cleaning no longer applied).
The script runs only on the supported sites listed below and:
- Rewrites the current page URL via
history.replaceState()to drop tracking params (e.g.utm_*, click IDs, session tokens). - Cleans links as the page renders them (a
MutationObserverwatches for dynamically-added links) and strips click-tracking attributes likeonmousedownandjsaction. - Resolves redirect wrappers so links point straight at their destination.
It matches sites regardless of top-level domain (.com, .ca, .fr, …) or
subdomain, except where excluded — some Google properties (Docs, Hangouts,
Takeout, etc.) are excluded because cleaning breaks them.
Dedicated handlers: Google, Bing, YouTube, Amazon, eBay, Newegg, Target, Facebook, IMDB, Disqus, Audible, LinkedIn, Etsy, Yahoo, Spotify, Reddit, Twitch, Threads, AliExpress, Walmart, Best Buy, TikTok.
The script does not run on any other site.
| Site | Before | After |
|---|---|---|
…/search?num=100&q=google&oq=google&gs_l=serp.3..&sclient=… |
…/search?q=google |
|
| Bing | …/search?q=google&qs=n&form=QBLH&pq=google&cvid=97312… |
…/search?q=google |
| YouTube | …/watch?v=ID&pp=…&feature=… |
…/watch?v=ID |
| Amazon | …/gp/product/ID/ref=…?th=1 |
…/gp/product/ID/ |
| eBay | …/itm/ID?hash=…&epid=… |
…/itm/ID |
…/photo/?fbid=ID&set=pcb.… |
…/photo/?fbid=ID |
|
| Target | …/p/A-ID?preselect=…&afid=… |
…/p/A-ID |
- Install a userscript manager — Tampermonkey or Violentmonkey.
- Open the GreasyFork page and click Install.
To install from this repo, open URLClean.user.js raw — Tampermonkey detects
the userscript header and offers to install it.
The whole script is a single file, URLClean.user.js. There is no
package.json, no bundler, and no linter — it installs directly into
Tampermonkey.
Editing what gets cleaned:
@includerules (metadata header) declare which sites the script runs on.- Parameter registry — per-site regexes naming which query params to strip.
clean<Site>()functions apply each site's param regex.parser<Site>()functions strip click-tracking attributes from links.
To add a site: add an @include, a param regex, a clean<Site>(), and (if
needed) a parser<Site>(), then wire it into site dispatch. See
CLAUDE.md for the architecture map and
CONTEXT.md for terminology.
The pure cleaner and redirect-decoder functions are unit-tested with Node's built-in test runner (no dependencies):
node --testCI runs the same on Node 20 for every push and PR. DOM integration paths (MutationObserver, live link parsing, click-tracking attributes) are verified manually in-browser — see ADR 0001 for why the test seam is drawn at the pure transforms.