Tzach
Tzach

Reputation: 13396

Marketo Munchkin synchronous requests hurt JS performance

Recently I noticed some performance issues in my site's javascript code. After some profiling I discovered that the problem is the Marketo Munchking code I use to track events. It looks like lately they changed their JS code to send synchronous http request for every call to Munchkin.munchkinFunction. The relevant code snippet is:

a=new XMLHttpRequest;a.open("GET",b,!1); ... a.send();

I've opened a ticket with Marketo, but until they fix their code, I'm looking for a workaround. I thought of a few:

  1. Is there a way to hook their js code to force the XMLHttpRequest to be async?
  2. It is safe to reference directly to older versions of their script, for example //munchkin.marketo.net/143/munchkin.js. I tested it and it works but maybe I'm missing something.

Are there any more workarounds? Any thought is appreciated.

UPDATE:

Just got a response from Marketo support. They admit that the calls are indeed synchronous, but they claim that this is the only way not to lose information. I guess they think of the case when a call to Munchkin.munchkinFunction is made just before a redirect. I disagree with them, and will ask them to provide an alternative. In the mean time I'm using an old version of their code.

UPDATE #2:

Got another response from their support team that said my ideas are good, but they can't implement them right now, and they hope that one of the developers will pick them up someday... Anyway I've created an idea in the Marketo community.

Upvotes: 8

Views: 2127

Answers (2)

Tzach
Tzach

Reputation: 13396

Update (Oct 2015): this feature is now documented here.

I just went over the new version of the Munchkin code (150) and found the following undocumented parameter:

Munchkin.init('XXXXXX', {asyncOnly: true});

I tried it and it does the job - all the HTTP requests are now async.

Upvotes: 12

michaelroper
michaelroper

Reputation: 293

Are you definitely using the asynchronous version of the tracking code? If you look in your Marketo admin, under Tracking Code, there is a drop-down to select the Tracking Code Type - make sure this is on Asynchronous, and then use that particular script block in your site.

Also, if you look under the Treasure Chest section in the admin, there is an option to enable the beta Munchkin code - maybe enabling try that if the above doesn't work.

Upvotes: 0

Related Questions