SOLVED

Update Cookie after form submission with REST API

Go to solution
Anonymous
Not applicable

Update Cookie after form submission with REST API

I am using the REST API to send info from a form I have built myself. I have no issues adding the user, but I have noticed there seems to be no way to update the cookie after the form is submitted when the user goes from being an anonymous lead to being a known lead.

I am using http://developers.marketo.com/documentation/rest/get-multiple-leads-by-filter-type to pull data by sending the cookie to prefill form fields if the user is a known lead. This works just fine if they come from a marketo hosted landing page (and their cookie is synced with their email and id), the lead is synced with their cookie and the form gets filled.

An issue occurs when they have never filled out a non REST based form. An anonymous lead has a cookie (_mkto_trk) and shows up to the REST API form. They fill it out and click submit. They now become a proper lead and have a marketo ID. However the cookie never changes and never gets tied to their email. Therefore, if they ever hit the form again (or any form marketo hosted landing page or not) they are not actually tied to the proper account, they are still cookied as anonymous.

So how using only the REST API or Munchkin Code can I tie the cookie and the marketo id/ email together? I am not interested in any solution that uses the SOAP api.
Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: Update Cookie after form submission with REST API

5 REPLIES 5
Anonymous
Not applicable

Re: Update Cookie after form submission with REST API

Anonymous
Not applicable

Re: Update Cookie after form submission with REST API

I have seen that, but having zero knowledge of php and no developer support available currently, there is little I can do with it since it specifically says not to do any of this in javascript. I am really looking for something that is doable with JS or the REST API only. I see that the soap API offers the ability to sync leads, but I don't see anything available with the REST API.

Are there plans to expand the usage of the REST API to be able to completely replace forms for this kind of thing? I assume this isn't a strange corner case and is actually something that a lot of people would want to do.
Anonymous
Not applicable

Re: Update Cookie after form submission with REST API

Just checked with engineering team, it is not possible to update cookie value via REST API. 
Anonymous
Not applicable

Re: Update Cookie after form submission with REST API

I managed to wrangle a developer to help with implimenting the AssociateLead Munchkin call. I see the GET request from the munchkin.js that sends the email '_mchAtemail' and the cookie value '_mchTk_' that are accurate. The response comes back as some sort of GIF code, but nothing else seems to happen.

If you hit the form with a properly linked cookie the form autofills using the Get Leads by Filter Type REST API call by sending the cookie. This works great if I fill out a marketo hosted landing page then come to my REST API form, but after using the AssociateLead I cannot get the form to autofill because the cookie isnt properly associated.

Thoughts?

I would love for associate lead to make its way into the REST API, which would streamline everything.

Anonymous
Not applicable

Re: Update Cookie after form submission with REST API

Associate Lead is the answer for sure. Took a while to sort through all the documentation but I am no able to replicate all the functionality of a Marketo Hosted Landing Page using the REST API and the Munchkin Associate Lead function. Thanks for your help Murtza.