Skip to content

Instantly share code, notes, and snippets.

@Phate334
Last active January 30, 2022 10:12
Show Gist options
  • Save Phate334/47dbb728d41c98c1e41a77c3782da52a to your computer and use it in GitHub Desktop.
Save Phate334/47dbb728d41c98c1e41a77c3782da52a to your computer and use it in GitHub Desktop.
bookmarklet for removing Click identifier
javascript: (() => {
const blocked = new Set(['fbclid', 'utm_source', 'utm_medium', 'utm_campaign', 'ref_src', 'ref_url']);
let url = new URL(document.URL);
let params = new URLSearchParams(url.searchParams);
for (let key of params.keys()) {
if (blocked.has(key)) {
url.searchParams.delete(key);
}
}
let result = `${url.origin}${url.pathname}${url.searchParams.toString() ? '?' + url.searchParams.toString() : ''}${url.hash}`;
navigator.clipboard.writeText(result);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment