Munchkin postWait example?

Anonymous
Not applicable

Munchkin postWait example?

Using Munchkin, could I get an example of the 'postWait' attribute being used?  I'm not sure what the syntax would look like or what actual calls it's used for.

This is in regards to the documetation here: 
http://developers.marketo.com/documentation/websites/lead-tracking-munchkin-js/
Tags (1)
4 REPLIES 4
Anonymous
Not applicable

Re: Munchkin postWait example?

The syntax you would use is:  "postWait ms 200;"
 
I would try something like this:
 
<script src="http://munchkin.marketo.net/munchkin.js" type="text/javascript"></script> 
<script> 
 mktoMunchkin("###-###-###"); 
 postWait ms 200;
 mktoMunchkinFunction('function', 
 { key: 'value', key2: 'value'}, 
 'hash'); 
</script>
 
If you posted your current Munchkin code and what you are trying to achieve, then I could help you debug. 
Anonymous
Not applicable

Re: Munchkin postWait example?

You could also use the setTimeout() JavaScript method to do the same thing. 
Anonymous
Not applicable

Re: Munchkin postWait example?

Thanks, what I'm trying to achieve is associate a new lead and capturing the click event of the registration button for that lead in successive steps.

Here's the javascript code:

    marketoUpdate = function (parameters, adminID, userID, key) {
        var marketoParameters = {
            Email: parameters.email
            // rest of parameters omitted for space
        };
 
        Munchkin.munchkinFunction('associateLead', marketoParameters, key);
 
        Munchkin.munchkinFunction('clickLink', {
            href: 'sign-up-submission?type=FT',
            Email: parameters.email
        });
    };

'associateLead' works fine on its own, but if I call 'clickLink' after it the lead doesn't even get created.  However if I pause the program before clickLink and resume it manually with considerable delay everything works (the lead gets created and the click event is recorded in their activiy log).

I don't think there's a response for associateLead I can use for a callback to call clickLink?  Any other suggestions are welcome!  
Anonymous
Not applicable

Re: Munchkin postWait example?

Hi John,
The beta version of munchkin tries a little harder to successfully complete calls before moving away from the page. You can try using that.
just switch the URL in your munchkin embed code.

instead of
//munchkin.marketo.net/munchkin.js

use
//munchkin.marketo.net/munchkin-beta.js

If that still does not solve your problems I think you should add your vote to this Idea https://community.marketo.com/MarketoIdeaDetail?id=08750000000HzjkAAC

regards,
DJ