Greasy Fork镜像 还支持 简体中文。

UTM param stripper

Drop the UTM params from a URL when the page loads.

  1. // ==UserScript==
  2. // @name UTM param stripper
  3. // @author Paul Irish
  4. // @namespace http://github.com/paulirish
  5. // @version 1.1.2
  6. // @description Drop the UTM params from a URL when the page loads.
  7. // @extra Cuz you know they're all ugly n shit.
  8. // @include /^https?:\/\/.*[\?#&]utm_.*/
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12.  
  13. // Install instruction!!!!
  14. // Click `raw` in the top right on this gist!
  15.  
  16. if (/utm_/.test(location.search) && window.history.replaceState){
  17. // thx @cowboy for the revised hash param magic.
  18. var oldUrl = location.href;
  19. var newUrl = oldUrl.replace(/\?([^#]*)/, function(_, search) {
  20. search = search.split('&').map(function(v) {
  21. return !/^utm_/.test(v) && v;
  22. }).filter(Boolean).join('&'); // omg filter(Boolean) so dope.
  23. return search ? '?' + search : '';
  24. });
  25.  
  26. if ( newUrl != oldUrl ) {
  27. window.history.replaceState({},'', newUrl);
  28. }
  29. }
  30.  
  31. // also..
  32. // drop this into your own site, in case people link to you with
  33. // email newsletters or your rss feed's feedburner tracking or whatever.

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址