Skip to content

Instantly share code, notes, and snippets.

@chancesmith
Created August 26, 2016 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chancesmith/624b7171fbb1757fb3537e7d7843b0de to your computer and use it in GitHub Desktop.
Save chancesmith/624b7171fbb1757fb3537e7d7843b0de to your computer and use it in GitHub Desktop.
Removes Google Analytics UTM variables from url after load
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