Skip to content

Instantly share code, notes, and snippets.

@wilmoore
Last active June 5, 2024 20:45
Show Gist options
  • Select an option

  • Save wilmoore/ff5a9a8b4f47d4c18485cec4d1a19c0f to your computer and use it in GitHub Desktop.

Select an option

Save wilmoore/ff5a9a8b4f47d4c18485cec4d1a19c0f to your computer and use it in GitHub Desktop.
Software Engineering :: Web :: Browser :: Extension :: Development :: QuerySweeper

Software Engineering :: Web :: Browser :: Extension :: Development :: QuerySweeper

⪼ Made with 💜 by Polyglot.

reference

About

QuerySweeper cleans up URLs by removing unnecessary tracking parameters, making them shorter and neater for copying and sharing without affecting your browsing session. This makes sharing links more straightforward and subtly enhances privacy by limiting tracking. Ideal for anyone looking to keep URLs clean and concise, QuerySweeper operates in the background, ensuring simplicity and a bit of extra privacy with every link you share.

Icon

image

Source

...

Create a new Url
const dirtyUrl = new URL(window.location.href);
const cleanUrl = new URL(window.location.href);
cleanUrl.search = '';

dirtyUrl.searchParams.forEach((parameterValue, parameter) => parametersToSweep.has(parameter) || cleanUrl.searchParams.append(parameter, parameterValue));

window.location.replace(cleanUrl);
Query Parameters To Sweep
const parametersToSweep = new Set([
  'utm_source',
  'utm_medium',
  'utm_campaign',
  'gclid',
  'fbclid',
  'msclkid',
  'dclid',
  'mc_eid',
  'mc_cid',
  'igshid',
  '_hsenc',
  '_hsmi',
  'trk',
  'trkCampaign',
  'sc_campaign',
  'sc_channel',
  'sc_content',
  'sc_medium',
  'sc_outcome',
  'sc_geo',
  'sc_cid',
  'piwik_campaign',
  'piwik_kwd',
  'pk_campaign',
  'pk_kwd',
  'yclid',
  'ali_trackid',
  'aff_platform',
  'aff_trace_key',
  'hmb_campaign',
  'hmb_medium',
  'hmb_source'
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment