It looks like there was a new piece of code deployed to all Marketo landing pages recently, /js/stripmkttok.js, and it has been automatically added to Marketo landing pages. This code is intended to remove the tracking parameter mkt_tok from end users' view via the HTML5 History API once the page is fully loaded. Unfortunately, this code doesn't work quite the way it should and often leaves extraneous characters if you are supplying your URL with other parameters (such as analytics tracking). This can be fixed by some alternate methods of approaching the problem; for example, using the following function corrects the issue:
var stripParam = function (key) {
var baseUrl = [location.protocol, "//", location.host, location.pathname].join(""),
urlQueryString = document.location.search,
newParam = key,
params = "?" + newParam;
if (urlQueryString) {
var removeRegex = new RegExp("([\?&])" + key + "=[^&;]+[&;]?");
params = urlQueryString.replace(removeRegex, "$1");
params = params.replace( /[&;]$/, "" );
}
params = params == "?" ? "" : params;
window.history.replaceState(
{}, "", baseUrl + params + window.location.hash
);
};
stripParam("mkt_tok");
If this functionality could be fixed as soon as possible, it would be appreciated—this has caused some unintended side effects.
Insert FacePalm emoji here.