Re: Recording User Activity using Munchkin JavaScript

Anonymous
Not applicable

Recording User Activity using Munchkin JavaScript

Hi Guys,

I'm working with Marketo for the first time and really hope someone here can point me in the right direction.

Currently I have some forms on my website that can successfully create leads in the Marketo database. These forms are sending data to Marketo via the REST API.
What I am now trying to do is capture the users activity, and associate that activity with that form submission.

After coming across this documentation:
Munchkin JavaScript API Calls

This is the understanding of how I think this should work (correct me if I am wrong)
1. When a user hits a page on your website, a cookie is created. (When you call  mktoMunchkin("###-###-###"));

2. As the user browses your website and does things like click a link you can record this actvitity in the cookie by calling for example

    mktoMunchkinFunction('clickLink', {

        href: '/MyClickedLinkONE/Story'

    });

3. Then after you submit the form you associate the activity with the submissions using the email address and this method

    mktoMunchkinFunction('associateLead', {

        Email: 'user@domain.com',

    });

I can see in the example on the documentation it also says you should supply some kind of key, the examples in PHP and I am a bit lots about how to do that?


I have tried to do these steps other than the key I just mentioned, I am still getting the form data into Marketo but I can NOT see the user activity.

I have also done the following:

In the head of all my pages (master page) I have added a reference to munchkin.js like this:

<script src="//munchkin.marketo.net/munchkin.js" type="text/javascript"></script>


and I'm not getting any errors in my browsers console.

Am I going in the right direction? Is there something that I am missing? any advice welcome

1 REPLY 1
SanfordWhiteman
Level 10 - Community Moderator

Re: Recording User Activity using Munchkin JavaScript

Am I going in the right direction?

Well, no.

You should not be using the REST API to submit forms.  You've opened a DoS attack against all your Marketo API integrations this way, among other downsides.

You should be using a hidden Marketo form and the Forms JS API for this, which will accomplish upserting Marketo leads, merging data, and associating web sessions all at the same time.

The process you're describing with JS associateLead has even more security risks attached and associator tokens can only be generated in a trusted environment.