Wordpress Elementor Forms and Munchkin Cookie - lead tracking

Irfan_Qureshi
Level 1

Wordpress Elementor Forms and Munchkin Cookie - lead tracking

Hi!

Figured I'd ask this here along with asking the Wordpress Plugin Devs. The questions is about merging anonymous visitor activity to a lead after a non-Marketo form fill.

I'm using a Wordpress Page Builder, Elementor. It comes with it's own Form module which allows a decent set of integrations except Marketo.

Screenshot 2019-08-05 at 09.55.39.png

Right now, when someone fills out the form, i post the data via webhook to zapier which then creates a lead in Marketo and adds it to list in a campaign. However, what I'm missing is the munchkin cookie lead association to conduct lead tracking.

Since this is a non-Marketo form, I imagine I need to use an AssociateLead call?

Any advice is appreciated. It would be nice to hear from someone who has managed to connect anonymous visitor activity when a visitor fills out a non-Marketo form.

2 REPLIES 2
Irfan_Qureshi
Level 1

Re: Wordpress Elementor Forms and Munchkin Cookie - lead tracking

So, I figured out a solution using the code published by Kenny E in his post: /blogs/marketowhisperer/2015/09/30/make-a-marketo-form-submission-in-the-background 

Essentially, I created a hidden Marketo form that submitted in the background. This meant that any activity conducted by the anonymous visitor is now attributed correctly to them as if they actually filled in a Marketo form. 

I did have to modify the code a bit.


<script src="//app-lon02.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_1554" style="display:none !important"></form>
<script type="text/javascript">
MktoForms2.loadForm("//app-lon02.marketo.com", "XXX-XXX-XXX", XXXX);
// $('#test-form').submit(function( event ) {
document.addEventListener("DOMContentLoaded", function(){
$('#form-button').on('click', (e) => {
var marketoForm = MktoForms2.allForms()[0];
let obj = {
//These are the values which will be submitted to Marketo
"Email": $('#Insert-Form-Field-ID').val(),
"FirstName": $('#Insert-Form-Field-ID').val(),
"LastName": $('#Insert-Form-Field-ID').val()
};
marketoForm.addHiddenFields(obj);
console.log('dump obj:', obj);
marketoForm.submit();
});
});
</script>
SanfordWhiteman
Level 10 - Community Moderator

Re: Wordpress Elementor Forms and Munchkin Cookie - lead tracking

Your code has a race condition, though.

In the event that someone submits your visible form before the Marketo form is ready, it will throw an error. Anything that depends on the Marketo form must be wrapped in MktoForms2.whenReady.


(Also, I assume the Email Address field is required on your Marketo form, otherwise every click on the visible form's submit button, regardless of whether the form data is valid, will result in a new lead in Marketo.)