Skip to content

Instantly share code, notes, and snippets.

@gpakosz
Created February 16, 2014 09:32
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 gpakosz/9031730 to your computer and use it in GitHub Desktop.
Save gpakosz/9031730 to your computer and use it in GitHub Desktop.
Remove GA cruft
if (window.history && history.replaceState && (location.search.match(/utm_/) || location.hash.match(/utm_/))) {
search = location.search.replace(/(\?|\&)?utm_[a-z]+=[^\&]+/g, '')
hash = location.hash.replace(/(#|\&)?utm_[a-z]+=[^\&]+/g, '')
history.replaceState({}, '', location.pathname + search + hash);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment