Created
August 26, 2016 16:48
-
-
Save chancesmith/624b7171fbb1757fb3537e7d7843b0de to your computer and use it in GitHub Desktop.
Removes Google Analytics UTM variables from url after load
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
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