AnsweredAssumed Answered

stripmkttok.js

Question asked by Jim Thao on Mar 22, 2019
Latest reply on Mar 22, 2019 by Jim Thao

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);

    });

})();

Outcomes