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:
XMLHttpRequest
to be async?//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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With