Associate API

Demosvc
Level 1

Associate API

I am looking for suggestion if anyone has implemented the associated API call for non-Marketo form. What can be the workaround to fetch the cookie value from the website when user fill-out non-Marketo form so that I can call lead creation API as well as associated API back-to-back. The Munchkin code is already deployed across website pages.

Tags (1)
3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: Associate API

You do not need multiple API calls for a single form post. One call to the Submit Form endpoint will cover it.

 

BUT I would strongly caution against using the REST API here, as you are always creating a DoS vulnerability by using up valuable API calls in response to individual end user actions.

 

What is the exact reason (please be detailed) that you aren't using the Forms 2.0 JS API, i.e. the unlimited client-side API, to submit a hidden Marketo form instead?

Demosvc
Level 1

Re: Associate API

Hi @SanfordWhiteman 

Calling  Submit Form will also serve the purpose, but actual ask is how to retrieve the cookie value which can be mapped with visitor data when calling the submit form API. is there any workaround to read the cookie which is set by Munchkin code so that It can be passed correctly in the Submit Form API.

SanfordWhiteman
Level 10 - Community Moderator

Re: Associate API

It's a browser cookie accessible from JS. You read it like any other cookie, e.g. from document.cookie:

 

const cookieSnapshot = new URLSearchParams( document.cookie.replace(/%|&/g,encodeURIComponent).replace(/;\s*/g,"&") );
const munchkinCookie = cookieSnapshot.get("_mkto_trk");

 

 

Not sure what else you're asking about. Also, as noted above, why aren't you using the far more scalable hidden form method?