We had a company do a custom implementation to make Marketo forms embedded onto our website (i.e. not on marketo landing pages), have their fields prefill if the Marketo cookie info exists. On my first read through of Marketo's announcement that they are changing how it will work , I'm pretty sure our custom work will stop working and prefill will no longer happen (which stinks), but I'm trying to confirm it one way or the other.
I'm hoping someone can read through the info below and confirm 100% either way whether our implementation will stop working. It may not be enough information but hopefully it is...
The company who did the work said they would do it this way:
Suggested solution:
And the "documentation" they referred to is this below:
ISSUE: Marketo Form Fields on our site are not prefilling with users info. When someone submits a Marketo form and later returns to another page with a Marketo form on it, the fields are NOT prefilled. This makes it annoying for the user to have to re-enter their information if they want to download another gated asset.
SOLUTION: Use REST API to get lead data from Marketo (via stored cookie) and use JS to populate the form fields.We contacted Marketo support and they pointed us to this page:http://developers.marketo.com/blog/external-page-prefill/
We technically could do everything via Javascript but as I’m sure you know, making the REST call via the browser is a no-no because it would expose our “client_id” and “client_secret” to the public. So we need to make the REST calls via the server-sideIn addition to the link above that Marketo pointed us to, this other page explains how to get the cookie info via JS and then make the REST call to get the associated lead datahttp://developers.marketo.com/blog/get-a-visitors-cookie-id-and-then-query-associated-lead-data/
NOTE: This git repo has some existing code for Marketo REST calls (including C#), which could be helpful: https://github.com/Marketo/REST-Sample-Code
OVERALL STEPS:There will be two REST calls to Marketo:
Use Javascript to read the existing Marketo cookie. This is obviously needed for the 2nd REST call above.
Once the 2nd REST call returns the lead data, it needs to be printed to the “mktoLead” variable:
Finally, map the lead data into the proper fields of the form
That approach, while technically horrifying and subject to an easy DoS attack, will not be specifically affected by the change.
(Just use my Pre-Fill code. It has no server involvement of any kind. And it's completely free for anyone on any site.)
Hi Sanford,
If you don't mind, could you give me a quick summary as to why it's technically horrifying? I would like to potentially discuss it with the company who did it, especially if there are security risks with how it's been implemented.
Regardless, where can I find your pre-fill code? Not involving the server at all would be ideal, but I didn't think that was feasible, so I'd love to see your solution. And I would probably change our implementation to your solution if it's as simple as it sounds.
Thanks!
Gary