Secret Options To Speed Up Marketo Munchkin Code

Marketo munchkin.js is the tracking code that is added to all Marketo pages that allows you to track known and unknown visitors to your website. I was getting some reports of slowness when users were clicking on links of our site and it seemed to be caused by the munchkin.js link tracking code.

In our case, we really only cared about the page that the user visited, not really the links that were clicked on, so I was looking for a way to disable the link click tracking in the munchkin code. Any searches for customizing the munchkin code seemed to land me on this Lead Tracking page from Marketo. It didn't have a lot of details about disabling things, but the one part that was helpful toward the bottom was about the click link delay. 

When a link is clicked, or a Web page visit has been completed, Munchkin delays before completing the action (sending through the link click or posting a form). The default delay is 200 milliseconds.

It turns out the default delay is actually 350ms when I dug through the munchkin.js code. So in your tracking code, when you call Munchkin.init(), you can send it an additional parameter of {clickTime:100} which will change the click time to be 100ms instead of the default. It looks like this:

Munchkin.init("###-###-###",{ clickTime : 100 });

While digging through the code, I actually found a few other parameters that you can set to customize the way your munchkin tracking behaves.

  customName: null,
  notifyPrefix: null,
  wsInfo: null,
  altIds: [],
  visitorToken: null,
  cookieLifeDays: 730,
  clickTime: 350,
  cookieAnon: !0,
  mkt_tok: null,
  domainLevel: null,
  replayDetectLimit: 5E3,
  httpsOnly: !1,
  asyncOnly: !1

What I found was that setting asyncOnly:false and clickTime:0 effectively disables the delay caused by clicking links (if you don't care about them). So my code looks like:

Munchkin.init("###-###-###", { clickTime : 0, asyncOnly : true });

I didn't see this published anywhere so hopefully this helps someone.