Re: associateLead "suddenly" not working

Dara_Wong
Level 1

associateLead "suddenly" not working

Hello, all.

The associateLead function on our web site seems to have stopped working for "some" visitors.

Our web site is still tracking visitors each day but associateLead is not working as expected.

I have created a test script to see what is happening and some odd behaviour is occurring.

I have included code I am using for testing below:

<script>

mktoMunchkin("XXX-XXX-XXX");

mktoMunchkinFunction('associateLead',

{

// Lead Attributes

Email: 'person@company222.com',

FirstName: 'Jimmy'

},

'<?php echo hash('sha1', 'API_KEY' . 'person@company222.com')); ?>'

</script>

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

When I execute this page/script, nothing happens. The new lead is not created in Marketo.

We need to be able to automatically create leads when specific forms are filled out on our web site.

If I can't get this basic test to work I certainly won't be able to get the forms to function as expected.

Everything was working up until very recently and we are not sure what has changed if anything.

  • The API Key being used has been confirmed and is correct. I even tried changing the Key in Marketo and trying that in the script but this still does not work.
  • The "XXX-XXX-XXX" is here for example only and this 9 character code is correct in the actual script.

I can't update or create leads using this simple test code.

What could possibly be happening?

Executing this code in the past would create/associate lead and this is no longer doing this.

Thanks

Dara

Tags (1)
13 REPLIES 13
Jay_Jiang
Level 10

Re: associateLead "suddenly" not working

Can you hard code the sha hash into the test script and see if it works.

Maybe someone updated or changed your php server settings?

Just read that it's works for some people. Munchkin won't load if the person is using firefox private browsing, and for that reason, it's not ideal to rely on it to CREATE leads.

Consider making an ajax POST to leadCapture/save2 endpoint, then in a success callback, make an munchkin associate lead call to track the web activity.

Dara_Wong
Level 1

Re: associateLead "suddenly" not working

The sha1 hash is being generated properly on the server side.

The php is generating the following javascript (properly as expected);

mktoMunchkinFunction(

'associateLead',

{

Email: "jimmy@test456.com",

FirstName: "Jimmy",

LastName: "Tester",

Company: "Test company",

Country: "CA"

},

'<?php echo hash('sha1', 'API_KEY' . 'jimmy@test456.com'); ?>'

);

This produces a hash of "0fb7fdcb3b3478420ef6c9d1dfa435c5298e45d2".

Should the API Key be a specific number of characters long? I recreated mine and made it rather long.

Thoughts?

Thank you!

SanfordWhiteman
Level 10 - Community Moderator

Re: associateLead "suddenly" not working

Should the API Key be a specific number of characters long? I recreated mine and made it rather long.

That's fine, the hashing function isn't going to have a problem until you reach 1 quintillion characters.

Dara_Wong
Level 1

Re: associateLead "suddenly" not working

I am not using private browsing and I have tried several browsers. This is also not working for our customers.

However, "some" web traffic is showing up and "some" leads are being created by other means but not by using associateLead.

This worked for years with no issue and we're not sure what may have caused this.

Jay_Jiang
Level 10

Re: associateLead "suddenly" not working

In your chrome/firefox inspector can you check what's going on in the console and network traffic tabs?

Dara_Wong
Level 1

Re: associateLead "suddenly" not working

I noticed this as well in console.

There is an error displayed:

ReferenceError: mktoMunchkin is not defined

Even though I am including the munchkin code on the page.

Jay_Jiang
Level 10

Re: associateLead "suddenly" not working

Can you share your test page url

Dara_Wong
Level 1

Re: associateLead "suddenly" not working

I would prefer not to.

Is there an option to send private?

Jay_Jiang
Level 10

Re: associateLead "suddenly" not working

Follow me back and you can PM me the url