← All posts

Tutorials

Privacy hygiene: strip tracking params with JustZix

Every link you click and share is decorated with tracking parameters — utm_source, fbclid, gclid and friends. They do nothing for you and everything for analytics dashboards. With JustZix you can strip them locally, so the URLs you copy and the links you follow are clean. This is defensive hygiene only: no blocking lists to circumvent, no requests faked — just tidier URLs.

Clean the address bar on page load

Create a JavaScript rule with a broad match like *://*/* (or scope it to the sites you care about). This rule rewrites the current URL in place using the History API, removing known tracking keys without reloading the page.

const JUNK = [
  'utm_source','utm_medium','utm_campaign','utm_term','utm_content',
  'fbclid','gclid','dclid','msclkid','mc_eid','mc_cid','igshid',
  'ref_src','ref_url','vero_id','oly_enc_id','_hsenc','_hsmi'
];

const url = new URL(location.href);
let changed = false;
for (const key of JUNK) {
  if (url.searchParams.has(key)) {
    url.searchParams.delete(key);
    changed = true;
  }
}
if (changed) {
  history.replaceState(null, '', url.toString());
}

Nothing leaves the browser. history.replaceState only updates the address bar and the value of location.href — so when you copy the URL, it is already clean.

Scrub tracking params from links you click

Pages are full of outbound links pre-tagged with tracking params. This JS rule walks every anchor on the page and removes junk parameters from its href, so a copied link or a middle-click opens clean.

const JUNK = ['utm_source','utm_medium','utm_campaign','utm_term',
  'utm_content','fbclid','gclid','msclkid','igshid'];

function cleanLink(a) {
  let u;
  try { u = new URL(a.href, location.href); }
  catch (e) { return; }
  let changed = false;
  for (const key of JUNK) {
    if (u.searchParams.has(key)) { u.searchParams.delete(key); changed = true; }
  }
  if (changed) a.href = u.toString();
}

function scan() {
  document.querySelectorAll('a[href]').forEach(cleanLink);
}

scan();
new MutationObserver(scan).observe(document.body, {
  childList: true, subtree: true
});

The MutationObserver re-scans when new links appear, which matters on infinite-scroll pages. It only edits href attributes already in the DOM — it never opens connections.

Hide tracking pixels

Tracking pixels are tiny invisible images loaded purely to register a view. A CSS rule cannot stop the request that already fired, but it makes leftover 1×1 images visually irrelevant and confirms what is on the page. Create a CSS rule scoped to *://*/*.

/* Collapse classic 1x1 tracking pixels */
img[width="1"][height="1"],
img[src*="/pixel"],
img[src*="/track"],
img[style*="width: 1px"] { display: none !important; }

For real network-level blocking you still want a dedicated content blocker — this rule is about decluttering and visibility, not interception.

Tidy "copy link" output

Some sites append a referral tag the moment you use their share button. A JS rule can intercept the clipboard write and clean it. Scope it to the specific site and keep it minimal.

const JUNK = ['utm_source','utm_medium','utm_campaign','fbclid','igshid'];

document.addEventListener('copy', (e) => {
  const text = (window.getSelection() || '').toString();
  if (!/^https?:\/\//.test(text.trim())) return;
  try {
    const u = new URL(text.trim());
    JUNK.forEach(k => u.searchParams.delete(k));
    e.clipboardData.setData('text/plain', u.toString());
    e.preventDefault();
  } catch (err) { /* not a URL, leave it */ }
});

This only acts when the selected text is a single URL, and it writes to the clipboard you triggered yourself. It is a convenience, not an interception layer.

Keep it defensive

Everything here stays on your machine: rewriting your own address bar, editing visible link attributes, hiding leftover pixels. None of it forges traffic or breaks a site\'s terms. It simply means the URLs you share do not carry someone else\'s analytics ID.

See more privacy-minded recipes in our ready-made examples, and pair this with the social feed declutter guide. Download JustZix and start with the address-bar cleaner.

Rate this post

No ratings yet — be the first.

Try it yourself

Install JustZix and paste any snippet from this article. Two minutes from zero to a working rule across all your devices.

Get JustZix

Features · How it works · Examples · Use cases