Skip to content

Instantly share code, notes, and snippets.

@bcjordan
Created August 19, 2016 18:34
Show Gist options
  • Save bcjordan/21bc2108925cc1b785d6a3e98d4fd287 to your computer and use it in GitHub Desktop.
Save bcjordan/21bc2108925cc1b785d6a3e98d4fd287 to your computer and use it in GitHub Desktop.
Get rid of those pesky GA parameters from your URL bar!
// ==UserScript==
// @name Remove GA parameters
// @namespace http://bcjordan.com
// @version 0.1
// @description Get rid of those pesky GA parameters!
// @author You
// @match *://*/*
// @grant none
// ==/UserScript==
// To install:
// 1. Install TamperMonkey https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo
// 2. Click "Raw" above.
(function() {
'use strict';
const loc = window.location;
if (loc.search.includes('utm')) {
if (window.history.replaceState) {
history.replaceState({}, '', loc.pathname);
} else {
loc.hash = '';
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment