Auto Fill Embedded Forms (not on Marketo landing page) | Community
Skip to main content
Eric_Salamon1
Level 6
June 1, 2017
Solved

Auto Fill Embedded Forms (not on Marketo landing page)

  • June 1, 2017
  • 1 reply
  • 11892 views

This is a fun one. I have tried to use auto fill forms in the past and it worked, but that was because I was not embedding the form on the web site.

Environment

Right now I am working with a WordPress site, and have discovered that my predecessor really mucked it up. There were 3 outdated Marketo Plug-ins, the wrong Munchkin code and lots of additional things that brought the site performance down. On top of that all the forms were Iframed. The site also has lots of mixed content HTTP, and HTTPS, right now we are working to move to HTTPS which has issues with the Iframes, because the Marketo instance is not secured with the SSL certificate. (There is an additional cost to adding the certificate in Marketo and there is a small amount of down time.)

Embedding the forms is the solution I came up with, but they don't auto fill. This isn't a deal breaker, but I would like to make things easier for people when they fill out forms.

Research

I have been putting together some information based on the scripts and other sources I noticed:

http://developers.marketo.com/rest-api/assets/forms/examples/

http://developers.marketo.com/javascript-api/forms/

Auto populate form from Marketo cookie and auto submitting the form

http://developers.marketo.com/blog/external-page-prefill/

The concept looks secure, but the instructions for implementing them are not. Writing the JS I could probably figure out, but how would one connect the REST API to the website to pull the field data?

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

<form id="formID"></form>

<script>

  MktoForms2.loadForm("Link", "Marketo Stuff", Form#,function(form) {

  var prefillFields = {

  "Email" : mktoLeadFields.email,

  "FirstName" : mktoLeadFields.firstName,

  "LastName" : mktoLeadFields.lastName,

  "Company" : mktoLeadFields.company

  };

  }

  );

</script>

This is where I got in the coding setup any additional advise would be great.

Message was edited by: Eric Salaman

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

Thanks Sanford, I'm a terminology purist but new to Marketo so appreciate you breaking it out like this. So what we're looking for is Known Visitor HTML: when someone clicks on an email link, we want the embedded form (on a WordPress page) to recognize the user from only the marketo token on the URL (no cookie), and present a "Download" button instead of the full form + Download button. The forms we currently have do recognize Known Visitors and collapse the form when there is a cookie present, but don't when loaded solely with the Marketo token. The main use case is if a Known User clicks on an email from a different device than they used to initially become a Known User or have cleared cookies, and in the case where we know the user in Marketo but they are "cold" in that they never filled out a form and were cookied by Marketo.

Maybe we're missing something simple in configuration? We're open to and capable of customizing the embedded JavaScript if needed.

I definitely appreciate the security risks associated with being able to "pull" arbitrary Marketo data via JavaScript, which is what PreFill of embedded forms would amount to. Not looking to do that!

Thanks for your help.


So what we're looking for is Known Visitor HTML: when someone clicks on an email link, we want the embedded form (on a WordPress page) to recognize the user from only the marketo token on the URL (no cookie), and present a "Download" button instead of the full form + Download button. The forms we currently have do recognize Known Visitors and collapse the form when there is a cookie present, but don't when loaded solely with the Marketo token. The main use case is if a Known User clicks on an email from a different device than they used to initially become a Known User or have cleared cookies, and in the case where we know the user in Marketo but they are "cold" in that they never filled out a form and were cookied by Marketo.

Maybe we're missing something simple in configuration? We're open to and capable of customizing the embedded JavaScript if needed.

Yes, known Visitor HTML works based on either the runtime associator token (mkt_tok) or the Munchkin cookie (_mkto_trk). It's not necessary to load Munchkin nor have an existing cookie.

You don't any custom JS to make this work unless you have some other custom JS that's messing it up!

Please provide your URL so I can inspect it.

1 reply

SanfordWhiteman
Level 10
June 1, 2017

but how would one connect the REST API to the website to pull the field data?

Don't do this.

Any would-be solution that makes a direct REST API call in response to ungoverned user activity can't be used in a professional environment. (No reason to mince words about such bad design.)

The concept looks secure

It's not really about security, it's about DoS vulnerability -- and the resulting effect on the reliability of this and your other integrations.

Eric_Salamon1
Level 6
June 6, 2017

That makes sense, but do you have any other recommendations for auto filling in forms if they are embedded on the webpage. Again Iframes won't work.

Becky_OConnor
Level 1
December 18, 2017

Hi, did you ever figure out a solution to this?  We're facing the same issue.