4 ms·
You could use the HTML5 History API to remove these query strings once Google Analytics is done using them. (This example assumes you'd never want query strings
by yahelc 15y ago
You could use the HTML5 History API to remove these query strings once Google Analytics is done using them. (This example assumes you'd never want query strings, but could be refined to just remove utm_* query strings.
if (window.history && history.replaceState && location.search.match(/utm_/)) {
var check = setInterval(function () {
if (document.cookie.indexOf("__utmz=")!==-1) {
history.replaceState({}, "", location.pathname); //assuming you want no query string
clearInterval(check);
}
}, 500);
}