Form pre-fill for Marketo forms not hosted on Marketo landing pages | Community
Skip to main content
September 18, 2014
Question

Form pre-fill for Marketo forms not hosted on Marketo landing pages

  • September 18, 2014
  • 12 replies
  • 5483 views

I just learned that pre-fill isn't available for Marketo forms not hosted in Marketo landing pages. 

Does anyone know a custom way to make Marketo forms auto-fill when hosted on WordPress? Hoping there's a JavaScript trick or something but could be wishful thinking. 

Thanks,

David

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

12 replies

Stijn_Heijthuij
Level 6
September 18, 2014
Hi David,

From what I've seen and read you can do it with an iFrame.
Both your wordpress and your marketo domain will need to have the same top-level domain (*.yourcompany.com) and the security framework (http:// or https://) will need to be the same.

It's something I'm going to be trying in a couple of days when our Marketo landingpages get their SSL-certification.


Stijn
Dory_Viscoglio
Level 10
September 18, 2014
Hi David, I believe that this is pretty well controlled on sites that aren't Marketo sites (or anywhere the embed code is used), for security purposes. 
Level 2
September 18, 2014
As Stijn said, it works if you use an iframe and not the embed code.  Here is the article with basic instructions: https://community.marketo.com/MarketoResource?id=kA650000000GuJJCA0 
Jep_Castelein2
Level 10
September 18, 2014
Unfortunately, the iframe solution doesn't work for Forms 2.0. If you started with Marketo before Forms 2.0, you still have the option to create Forms 1.0 forms. 

It is possible to custom build a pre-fill mechanism, but it's a fair amount of work for a PHP developer. Either, you need to sync the Marketo Leads to Wordpress, or you need to make a real-time call to the Marketo REST API to retrieve the data and then pre-fill. 
Ulf_Deeg
Level 3
July 14, 2015

What would keep you from creating a Landing Page with a Form 2.0 and pull in the LP in an iframe?

September 18, 2014
According to that web page about iframes, this approach only works for Marketo Forms 1.0. We're using 2.0.

Any other ideas? 
September 18, 2014
Thanks Jep. In our case, we have SPARK edition. So, we don't have access to the Marketo API. Any information out there on how to sync the Marketo leads to Wordpress? Just trying to gauge how many development hours would be required. Sounds like this may be quite a task. 
September 18, 2014
@Jep. How would we go about doing that Marketo REST API call? Can you point to any documentation?
Aida_Kamber
Level 2
July 13, 2015

I was able to find some documentation here: http://developers.marketo.com/blog/external-page-prefill/

However, we are still having issues and getting errors when testing this using Rest API.

Here is the info our developer has sent me outlining the issues. Can anyone help?

As per above link to prefill in external non marketo , we need to first authenticate with marketo and after that we can access the data from marketo. When we tried to access rest api for authentication, we received an error due to cross domain (here is the error message XMLHttpRequest cannot load 007-aqx-577.mktorest.com/identity/oauth/token?grant_type=client_cre…3b4e-4f3d-aaca-1251c132360c&client_secret=9Z5v4g8e9PPnHtIiRrwjNSchaN8ZUxQZ. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'jord.webstarts.com' is therefore not allowed access.)

Below is code snippet:-

<script>
alert('testentryfunction');
var url = "https://007-AQX-577.mktorest.com/identity/oauth/token?grant_type=client_credentials&client_id=300e4489-3b4e-4f3d-aaca-1251c132360c&client_secret=9Z5v4g8e9PPnHtIiRrwjNSchaN8ZUxQZ";
var client = new XMLHttpRequest();
client.open("GET", url, false);
client.responseType = "application/json";
client.setRequestHeader("Content-Type", "application/json");
client.setRequestHeader("Access-Control-Allow-Origin", "*");
client.send();
alert('testexistfunction');
</script>

We tried accessing the same url with chrome poster and it's working fine, but when we are adding it into a site exposed over the Internet for testing, we are getting an error. This call is going through a browser and I think we can’t use these API’s directly from a browser. If this is true then do we need to first call rest API from .Net, get data and then pre-populate on form when it's loaded?

SanfordWhiteman
Level 10
July 13, 2015

Correct. You must not use the APIs from a browser because you would be exposing your secret key to the world.

So the way to do this is by using .NET as a proxy to call the REST API securely and return results.

Or fly up to NYC for my talk at the August MUG meeting and learn how to do it all in the browser without any security leaks.

Jep_Castelein2
Level 10
September 18, 2014
Timothy, it's not a standard feature so there is no documentation. One of of our customers implemented this, back then using the SOAP API. Since we now have a REST API, that is a little faster for read-access, so I would recommend using that. 
September 18, 2014
Sounds like a wonderful post for Murtza Manzur and the developmenet community. This should really be created. 
September 19, 2014
@Jep are you saying that the pre-fill feature will not work if you put a forms 2.0 in an iframe? I am trying to solve this same issue where I want to embed a MKTO LP with a form2.0 on our own web page, and not sacrifice the form pre-fill function.