SOLVED

Re: Marketo Known Visitor Form Submission not recieved

Go to solution
AdminDevSoc
Level 1

Marketo Known Visitor Form Submission not received

Im trying to send UTM values back to Marketo once someone click on our Known Visstor button I have added the hidden utm fields to the form when not you is detected.

Whenever we click on our custom button its not sending any information back to Marketo that the form was filled out. Is their some extra step I have to take to ensure that those values are captured and submitted.
 


1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo Known Visitor Form Submission not recieved


The goal is that once someone visits the page with utm parameters they submit the form and once they do i save those values as a cookie that way anytime someone revisits and gets the known visitor page I can resend those saved cookie values once they click the Known Visitor button.

I’m sure that’s the intent, but your JS is broken in numerous ways.

 


however when I click on that button it seems to do nothing but it does show a console error 

Yes, and you can easily debug that error. Not sure why you didn’t look further into it yourself.

 

The error is because you have a custom onValidate function to reject non-business emails, and you’re adding the listener in both standard and KV HTML mode.

 

Needless to say, you can’t validate the Email value when the <input name="Email"> element is not even present on the form. The direct cause is that Marketo can’t find a place to put your custom error message. The root cause is you can’t validate fields that aren’t there.

 

Also, your custom function has a fundamental bug because you’re not escaping the special regex dot. /@(aol.com)$/i matches the string joe@aolecom.

View solution in original post

5 REPLIES 5
SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo Known Visitor Form Submission not recieved

A Known Visitor form fillout appears in the Activity Log exactly like a standard form. It simply doesn’t put all the fields on the wire.

 

So if it’s “not sending any information back to Marketo that the form was filled out” — nothing in the Activity Log — you’ve made a serious config error. Please link to your page.

 

P.S. Known Visitor also doesn’t support native Hidden field auto-fill. You didn’t specify whether you’re using the native feature or using the Forms 2.0 JS addHiddenFields() method (which does work in all cases).

 

AdminDevSoc
Level 1

Re: Marketo Known Visitor Form Submission not recieved

Hi Sandford,

https://www.socure.com/mkto-utm-cookie-test/?formid=1577&munchkinId=570-ENG-578&UTM_Campaign__c=test...

here is the url where we are trying to add this feature. After filling the form we save the values in a cookie which are used for the hidden fields on known visitor. We are using the addHiddenFields() method.

The initial form submit is working and sending information to activity log but known visitor is not.

SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo Known Visitor Form Submission not recieved

Your problem is right here:

 

kvSubmitButtonEl.addEventListener("click", function(e) {
  e.preventDefault();
  try {
    formEl.submit();
  } catch (err) {
    console.log(err)
  }

 

 

You can’t submit the native HTML form element. That naturally overrides the Marketo XHR submit and the data is sent to your server, not to Marketo. Only call the Marketo Forms 2.0 JS submit() method on the form object.

 

But not sure why you’re adding this code in the first place. In general, the code on this page should be reviewed. For example, this line is almost certainly not doing what you want:

document.cookie = "utm_campaign=, utm_medium__c=, utm_source__c=, utm_content__c=, utm_adgroup__c=, utm_keyword__c=; gclid__c=;expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";

 

You can’t write or delete more than one cookie at the same time.

AdminDevSoc
Level 1

Re: Marketo Known Visitor Form Submission not recieved

Hi There,
The goal is that once someone visits the page with utm parameters they submit the form and once they do i save those values as a cookie that way anytime someone revisits and gets the known visitor page I can resend those saved cookie values once they click the Known Visitor button.

I have changed the implementation to use the form object from 

MktoForms2.whenReady

and call submit on this click of the button . The issue still remains and it looks like nothing is happening on the page. 




however when I click on that button it seems to do nothing but it does show a console error 
SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo Known Visitor Form Submission not recieved


The goal is that once someone visits the page with utm parameters they submit the form and once they do i save those values as a cookie that way anytime someone revisits and gets the known visitor page I can resend those saved cookie values once they click the Known Visitor button.

I’m sure that’s the intent, but your JS is broken in numerous ways.

 


however when I click on that button it seems to do nothing but it does show a console error 

Yes, and you can easily debug that error. Not sure why you didn’t look further into it yourself.

 

The error is because you have a custom onValidate function to reject non-business emails, and you’re adding the listener in both standard and KV HTML mode.

 

Needless to say, you can’t validate the Email value when the <input name="Email"> element is not even present on the form. The direct cause is that Marketo can’t find a place to put your custom error message. The root cause is you can’t validate fields that aren’t there.

 

Also, your custom function has a fundamental bug because you’re not escaping the special regex dot. /@(aol.com)$/i matches the string joe@aolecom.