Re: Including Munchkin.js does not creating an anonymous lead

Anonymous
Not applicable

Including Munchkin.js does not creating an anonymous lead

Hi Marketo,

On my website, I have included Munchkin.js inclusion code and it creates a new cookie correctly. However, it does NOT create an anonymous lead in Marketo.

While I'm hitting the page with no cookie, I'm checking the lead database.

Just to make it sure, I have created one smart list that only shows an anonymous lead and it's not creating a lead.

I'm also checking all leads in case it's created as a known lead and it's not there either.

In every case, _mkto_trk cookie is set correctly.

Can you give me any advice on this?

8 REPLIES 8
SanfordWhiteman
Level 10 - Community Moderator

Re: Including Munchkin.js does not creating an anonymous lead

Well, you have to call Munchkin.init('AAA-BBB-CCC'); as well as loading the core JS file. (Where AAA-BBB-CCC is your Munchkin ID.)

The most targeted place to see web activity is a Web Page Activity report. On the Setup tab, make sure Anonymous Leads is set to "Shown."

And post your actual URL so we can check it.

Anonymous
Not applicable

Re: Including Munchkin.js does not creating an anonymous lead

Munchkin.init() is called.

FYI after Munchkin.init() is called and it sets cookie to the browser, I also make AJAX request to my own serverside script that makes REST API call to createOrUpdate call.

Server side API request to Marketo DOES create a new lead with custom field values I set.

However, Munchkin.init() is NOT creating an anonymous lead I'm expecting.

Another question is I'm checking the full list of leads and smart filtered list from Lead Database section. Are you saying I had better not check from that place?

Anonymous
Not applicable

Re: Including Munchkin.js does not creating an anonymous lead

By the way the website is still under construction, so I can't give you the URL yet.

SanfordWhiteman
Level 10 - Community Moderator

Re: Including Munchkin.js does not creating an anonymous lead

The setting of the cookie doesn't mean that Munchkin is set up correctly, as the cookie is randomly generated on the client side.  Unless the server receives a Visit Web Page request keyed to your instance, there will be no lead created or updated.  In other words, with Munchkin.init('WHA-TEV-ER') you will still get a cookie.

Can you please post your actual URL?

I also make AJAX request to my own serverside script that makes REST API call to createOrUpdate call.

(a) Why? 

(b) Is this something you're leaving in production?

(c) If it's staying in prod, are you aware you can only fire this 10,000 times a day? The APIs should not be used this way; they're meant for offline batch use, not proxying end-user activities.

SanfordWhiteman
Level 10 - Community Moderator

Re: Including Munchkin.js does not creating an anonymous lead

I see your follow-up post now.  You can follow me and DM me the URL.  Attempting to troubleshoot network activity without seeing the real-life page is a dead end.

Anonymous
Not applicable

Re: Including Munchkin.js does not creating an anonymous lead

The setting of the cookie doesn't mean that Munchkin is set up correctly, as the cookie is randomly generated on the client side.  Unless the server receives a Visit Web Page request keyed to your instance, there will be no lead created or updated.  In other words, with Munchkin.init('WHA-TEV-ER') you will still get a cookie.

So, okay. Now my question is how I can check my Munchkin.init() successfully made a request to Marketo server. As far as I know, init() function does not return any value. Just wondering, if the site i'm building doesn't have publicly accessible URL yet (only can access locally on my machine), would it cause a problem?

Can you please post your actual URL?

The URL is not publicly available.

(a) Why?

(b) Is this something you're leaving in production?

(c) If it's staying in prod, are you aware you can only fire this 10,000 times a day? The APIs should not be used this way; they're meant for offline batch use, not proxying end-user activities.

(a) (b) It was just a part of testing while I'm building.

(c) Yes, I'm aware of the API limit per day.

SanfordWhiteman
Level 10 - Community Moderator

Re: Including Munchkin.js does not creating an anonymous lead

Just wondering, if the site i'm building doesn't have publicly accessible URL yet (only can access locally on my machine), would it cause a problem?

That can absolutely cause a problem.  Chrome does not allow cross-origin requests from localhost, for one example. Generally speaking you should not be developing anything involving cross-origin communication from http://localhost.  Rather, add an entry to your HOSTS file like

     127.0.0.1 mymachine.example.com

Then develop against http://mymachine.example.com

If you look in your Console and/or Dev Tools >> Network it's probable that you'll see failures.

Anonymous
Not applicable

Re: Including Munchkin.js does not creating an anonymous lead

I'm not using localhost. The testing URL is fully qualified one like yours.

I've got some debugging message from Firefox and Chrome console, and I will send a direct message to you.