Skip to content

Instantly share code, notes, and snippets.

@mach3
Created October 1, 2011 02:17

Revisions

  1. mach3 revised this gist Oct 1, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion remove-utm.txt
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    (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('&'):'')})();
    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('&'):'')})();
  2. mach3 revised this gist Oct 1, 2011. 2 changed files with 4 additions and 4 deletions.
    6 changes: 3 additions & 3 deletions remove-utm.js
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@
    (function(){
    var loc, search, params, i;
    loc = location;
    search = loc.search.replace( /^\?/, "" ).split("&");
    search = loc.search.replace( /^\?/, '' ).split( '&' );
    params = [];
    i = search.length;
    while( i-- ){
    @@ -14,5 +14,5 @@
    }
    }
    loc.href = loc.pathname
    + (( params.length ) ? "?" + params.join("&") : "" );
    })();
    + (( params.length ) ? '?' + params.join( '&' ) : '' );
    })();
    2 changes: 1 addition & 1 deletion remove-utm.txt
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    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("&"):"")})();
    (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('&'):'')})();
  3. mach3 revised this gist Oct 1, 2011. 2 changed files with 3 additions and 3 deletions.
    4 changes: 2 additions & 2 deletions remove-utm.js
    Original file line number Diff line number Diff line change
    @@ -13,6 +13,6 @@
    params.push( search[i] );
    }
    }
    loc.href = loc.href.split("?")[0]
    loc.href = loc.pathname
    + (( params.length ) ? "?" + params.join("&") : "" );
    })();
    })();
    2 changes: 1 addition & 1 deletion remove-utm.txt
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    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.href.split("?")[0]+((c.length)?"?"+c.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("&"):"")})();
  4. mach3 created this gist Oct 1, 2011.
    18 changes: 18 additions & 0 deletions remove-utm.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    /**
    * 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.href.split("?")[0]
    + (( params.length ) ? "?" + params.join("&") : "" );
    })();
    1 change: 1 addition & 0 deletions remove-utm.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    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.href.split("?")[0]+((c.length)?"?"+c.join("&"):"")})();