Created
April 16, 2021 11:09
-
-
Save alllex/ae1e8c522cdc9a140d03666cf464de8f to your computer and use it in GitHub Desktop.
A bookmarketlet, that remote any query parameters starting with `utm_` from the current URL.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: | |
(function () { | |
const oldSearch = window.location.search; | |
let newSearch = | |
oldSearch.replace(/&?utm_[^=]*?=[^&]*?(?:&|$)/ig, ""); | |
if (newSearch === "?") { | |
newSearch = ""; | |
} | |
window.location.href = | |
window.location.protocol + "//" + | |
window.location.host + | |
window.location.pathname + | |
window.location.hash + | |
newSearch; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment