Re: Heads Up: Fix for stripmkttok.js

Level 10

Heads Up: Fix for stripmkttok.js

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.pathname].join(""),
urlQueryString =,
newParam = key,
params = "?" + newParam;

if (urlQueryString) {
var removeRegex = new RegExp("([\?&])" + key + "=[^&;]+[&;]?");

params = urlQueryString.replace(removeRegex, "$1");
params = params.replace( /[&;]$/, "" );

params = params == "?" ? "" : params;

{}, "", baseUrl + params + window.location.hash

If this functionality could be fixed as soon as possible, it would be appreciated—this has caused some unintended side effects.

Level 3 - Champion Alumni

Re: Heads Up: Fix for stripmkttok.js

Insert FacePalm emoji here.

Kelly Jo Horton
Senior Client Partner