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
Have you been able to put a blog post together on using REST to implement external page prefill?
Thanks - Aida
Yep, right here: http://developers.marketo.com/blog/external-page-prefill/
Can you add an example to the blog post that shows calling the endpoint with javascript?
I have tried using jQuery and I get a "No Access Control Origin" when asking for json, and if I try with jsonp I get this error 'Uncaught SyntaxError: Unexpected token :' in the response.
Thanks!!
You must not call the REST API directly from the client side. That's even worse than the DoS vulnerability that you create by using the API at all.
Sounds like Kenny Elkington should update the blog to ensure users are aware of the risks involved - especially as I'm seeing more and more references to this blog post due to the increased need to use pre-fill on non-Marketo LPs. Or better yet, update it with a more secure approach. Just curious, the API call needs to be made for anyone that visits the form page, correct - since there's no way to determine whether or not a lead is KNOWN without doing so. And then if the call returns values (or doesn't return an error), we know the lead is KNOWN. Correct?
I would love it if the landscape of supported/suggested technologies could change.
There's a scalable, secure, reliable, yet not officially supported way to accomplish this. Unfortunately, I doubt I could get Marketo proper to agree that this is the way so I don't describe it here. It would appear to be a hack (I call it elegant!) compared to the seemingly intuitive API method, but the problem is the API method really isn't ready for prime time.
And yep, the first reason (though not the only one) that the API-based solution is such a tasty invitation for a DoS attack is that you're expending API calls even when the lead is anonymous. To avoid this, you can use hidden form with Known Lead HTML enabled to determine if the lead is known (or you could call an undocumented endpoint directly, but I won't advise that here). But honestly that just improves the scalability for non-malicious situations. Once someone is trying to hack you this won't make a difference.
Thanks a lot for you response.
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 https://007-aqx-577.mktorest.com/identity/oauth/token?grant_type=client_cre…3b4e-4f3d-aaca-1251c1323.... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://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=300e44...";
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?
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.
Thanks Sanford! OR you can come to ATL and present this solution in our MUG meeting
Let's see how it goes up here first!
Where do i sign up for this MUG meeting?
You can find the User Group list here.