Skip to content

Instantly share code, notes, and snippets.

@markhepburn
Created September 14, 2010 03:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markhepburn/578492 to your computer and use it in GitHub Desktop.
Save markhepburn/578492 to your computer and use it in GitHub Desktop.
// Clean up all those invasive and ugly utm_ parameters, so you can paste a url.
// (will reload the page, be warned)
(function(){
var qs = window.location.search.slice(1).split('&'),
newqs = [];
for (var i = 0; i < qs.length; i++) {
if (qs[i].slice(0,4)!='utm_') {
newqs.push(qs[i]);
}
}
window.location.search = (newqs.length ? '?' : '') + newqs.join('&');
})();
// as a bookmarklet:
// javascript:(function(){var qs=window.location.search.slice(1).split('&'),newqs=[];for(var i=0;i<qs.length;i++){if(qs[i].slice(0,4)!='utm_'){newqs.push(qs[i]);}}window.location.search=(newqs.length?'?':'')+newqs.join('&');})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment