associateLead "suddenly" not working | Community
Skip to main content
Dara_Wong
Level 2
April 10, 2019
Question

associateLead "suddenly" not working

  • April 10, 2019
  • 1 reply
  • 4794 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Jay_Jiang
Level 10
April 10, 2019

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
Dara_WongAuthor
Level 2
April 10, 2019

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
April 10, 2019

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.