Created
August 19, 2016 18:34
-
-
Save bcjordan/21bc2108925cc1b785d6a3e98d4fd287 to your computer and use it in GitHub Desktop.
Get rid of those pesky GA parameters from your URL bar!
This file contains hidden or 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
// ==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