SOLVED

Re: Add custom class to Marketo form submit

Go to solution
Erik_Heldebro2
Level 8

Re: Add custom class to Marketo form submit

Interesting How do you mean by special meaning?

SanfordWhiteman
Level 10 - Community Moderator

Re: Add custom class to Marketo form submit

There's a special exception to click tracking for the built-in button. (You can mirror this by adding class="mchNoDecorate" to your custom links.)

Erik_Heldebro2
Level 8

Re: Add custom class to Marketo form submit

Ahh great, as always thanks for the insight Sanford!

Callum_Pirie
Level 3

Re: Add custom class to Marketo form submit

Hi all,

Sorry if this is hijacking however I am having the same issue. Erik or Sanford is this the correct solution for tracking GA conversions for Marketo forms in OptinMonster??

<script src="//app-lon08.marketo.com/js/forms2/js/forms2.min.js"></script>

<form id="mktoForm_1109"></form>

<script>

    MktoForms2.loadForm("//app-lon08.marketo.com", "625-GXJ-187", 1109);

</script>

<script>

    MktoForms2.whenReady(function(form){ 

var formEl = form.getFormElem()[0], 

    submitEl = formEl.querySelector('input[type="submit"]'); 

 

  submitEl.className += ' om-trigger-conversion'; 

}); 

</script>

SanfordWhiteman
Level 10 - Community Moderator

Re: Add custom class to Marketo form submit

No, because it will log a conversion even if the form doesn't validate.

Callum_Pirie
Level 3

Re: Add custom class to Marketo form submit

Hi Sanford,

Any idea how to actually get conversions showing in OptinMonster then? Whatever is happening is not showing any conversions

here is a submission i added on Google - conversion goals not working - - The Google Advertiser Community - 1824435

SanfordWhiteman
Level 10 - Community Moderator

Re: Add custom class to Marketo form submit

To get only conversions showing, you have to create a hidden link (<a> tag) with that class, then fire a click() event on the link in the Marketo onSuccess listener.

It is very clumsy but the only way that OM will show real conversions.

Erik_Heldebro2
Level 8

Re: Add custom class to Marketo form submit

I can also fill in here, not using OptinMonster any longer but what I did to overcome this (somewhat crazy) problem of not being able to add a class to Marketo form elements was to hide the Marketo form button and add a button under the form (styled the same way) that would submit the selected Marketo form when clicked. This would of course trigger error messages when fields were not filled. Not sure if it's the greatest solution but it worked for me accross multiple forms!

SanfordWhiteman
Level 10 - Community Moderator

Re: Add custom class to Marketo form submit

I can also fill in here, not using OptinMonster any longer but what I did to overcome this (somewhat crazy) problem of not being able to add a class to Marketo form elements was to hide the Marketo form button and add a button under the form (styled the same way) that would submit the selected Marketo form when clicked. This would of course trigger error messages when fields were not filled. Not sure if it's the greatest solution but it worked for me accross multiple forms!

But that approach has the same problem as adding the class to the submit button (it isn't hard to add the class to the submit button).

The problem is you will be logging a "conversion" to OM whenever somebody clicks the button, not whenever the form is submitted. Thus you'll vastly inflate your numbers.

Callum_Pirie
Level 3

Re: Add custom class to Marketo form submit

Thanks again guys,

So regarding this hidden <a> tag Sanford do you know what the full code is incase I imput it wrong?

<script src="//app-lon08.marketo.com/js/forms2/js/forms2.min.js"></script>

<form id="mktoForm_1109"></form>

<script>

    MktoForms2.loadForm("//app-lon08.marketo.com", "625-GXJ-187", 1109);

</script>

Do i get rid of this??

<script>

    MktoForms2.whenReady(function(form){

var formEl = form.getFormElem()[0],

    submitEl = formEl.querySelector('input[type="submit"]');

  submitEl.className += ' om-trigger-conversion';

});

</script>