Created
September 20, 2017 02:09
-
-
Save mysticatea/b07c457eee71766d2df09b05159e5fee to your computer and use it in GitHub Desktop.
Tampermonkey
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
// ==UserScript== | |
// @name Remove utm_ | |
// @namespace http://mysticatea.jp/ | |
// @version 1.0.0 | |
// @description Remove utm_* from URL parameters. | |
// @author Toru Nagashima | |
// @match *://*/*?*utm_* | |
// @grant none | |
// ==/UserScript== | |
const url = new URL(location.href) | |
let removed = false | |
for (const key of url.searchParams.keys()) { | |
if (key.startsWith("utm_")) { | |
url.searchParams.delete(key) | |
removed = true | |
} | |
} | |
if (removed) { | |
history.replaceState(null, null, url) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment