Skip to content

Instantly share code, notes, and snippets.

@mach3
Created October 1, 2011 02:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mach3/1255503 to your computer and use it in GitHub Desktop.
Save mach3/1255503 to your computer and use it in GitHub Desktop.
utmのパラメータをURLから取り除くブックマークレット
/**
* Remove utm parameters from url
* ( Use this as bookmarklet )
*/
(function(){
var loc, search, params, i;
loc = location;
search = loc.search.replace( /^\?/, '' ).split( '&' );
params = [];
i = search.length;
while( i-- ){
if( !search[i].match( /^utm_/ ) ){
params.push( search[i] );
}
}
loc.href = loc.pathname
+ (( params.length ) ? '?' + params.join( '&' ) : '' );
})();
javascript:(function(){var 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])}}d.href=d.pathname+((c.length)?'?'+c.join('&'):'')})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment