Created
October 1, 2011 02:17
utmのパラメータを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
/** | |
* 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( '&' ) : '' ); | |
})(); |
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(){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