stripmkttok.js | Community
Skip to main content
Jim_Thao7
Level 8
March 22, 2019
Solved

stripmkttok.js

  • March 22, 2019
  • 2 replies
  • 3615 views

Has anyone run into this and perhaps have any insight as to what the context is on why Marketo is now removing mkt_tok values after the URL resolves? So far, I've found this to be happening on all Marketo hosted landing pages that are linked from an email with mkt_tok and the view as webpage link.

Looks to be happening in multiple sandboxes and instances so it seems to be a global thing perhaps?

Started seeing this exactly on the release date.

Anything would help at this moment, documentation, release notes, etc.

Full script:

// LM-100892: Once page process mkt_tok, remove parameter from URL

(function() {

var afterLoad = function (fn) {

if (window.attachEvent) {

window.attachEvent('onload', fn);

} else {

window.addEventListener('load', fn);

}

},

// get parameter from URL

getURLParameter = function (name) {

var returnVal = decodeURIComponent((new RegExp(name + '=' + '(.+?)(&|$)').exec(location.search) || ['', null])[1]);

return returnVal;

}

afterLoad(function () {

// Cache mkt_tok value into global variable, before stripping it from URL

window.__mktTokVal = window.__mktTokVal || getURLParameter('mkt_tok');

window.history && history.replaceState('', null, location.pathname + location.search.replace(/(\?)?mkt_tok=(.*?)(&|$)/gi, '$1$3') + location.hash);

});

})();

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

Yes, search for the support article on View As Web Page links not being shareable.

It's a regression masquerading as a fix, IMO. Not a good thing.

2 replies

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
March 22, 2019

Yes, search for the support article on View As Web Page links not being shareable.

It's a regression masquerading as a fix, IMO. Not a good thing.

Jim_Thao7
Jim_Thao7Author
Level 8
March 22, 2019