-
-
Save yudoufu/1704865 to your computer and use it in GitHub Desktop.
utmのパラメータをURLから取り除くブックマークレットとuser.js
This file contains hidden or 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(){var e,d,b,c,a;d=location;b=d.search.replace(/^\?/,'').split('&');c=[];a=b.length;while(a--){if(!b[a].match(/^utm_/)){c.push(b[a])}else{e=true}}if(e){d.href=d.pathname+((c.length)?'?'+c.join('&'):'')}})(); |
This file contains hidden or 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
/** | |
* Remove utm parameters from url | |
* ( Use this as bookmarklet ) | |
*/ | |
(function(){ | |
var search, params, i, re; | |
search = location.search.replace( /^\?/, '' ).split( '&' ); | |
params = []; | |
i = search.length; | |
while( i-- ){ | |
if( !search[i].match( /^utm_/ ) ){ | |
params.push( search[i] ); | |
} else { | |
re = true; | |
} | |
} | |
if (re) { | |
history.pushState('','',location.pathname + (( params.length ) ? '?' + params.join( '&' ) : '' )); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment