My company's current process is:
We capture the Marketo cookie id (forgive me for not using exact terminology here) in order to merge the anonymous record via the API call.
We have an oppty to update step 3 of the process and I now want to change to simply submit the form data and hopefully the cookie id.
Here is my layman’s layout of the new process.
Assume a simple form with only first name and email fields on it.
.submit(
formID: 1234
marketoCookieID: 123-2345-234,
firstName: JJ,
email:jj@domain.com
)
My questions to the community.
Solved! Go to Solution.
<form id="mktoForm_789" style="display:none;">
<script src="//pages.example.com/js/forms2/js/forms2.min.js"></script>
<script>
MktoForms2.loadForm( "//pages.example.com", "123-ABC-456", 789 );
MktoForms2.whenReady( function(form) {
form.addHiddenFields({
Email : "user@example.net"
});
});
});
</script>
The object passed to addHiddenFields uses the form field names, which are the same as the SOAP names.
Thanks Sanford,
So, if I repeat it back to you....
Given that this process is happening downstream from the website page being submitted,
the 'post-form submit procedure' will gather the data from our database, then
inside a php file, we will create a form, adding the data back into hidden fields, then
automatically submitting the form.
If i'm correct, then i only have one more question. Can i pass the anonymous munchkin person id in the form as a data field and will marketo handle the merge? or will i have to do that in another process once i get a success response with the person id?
BTW, if you haven't been told recently, you are appreciated in the Marketo Community.
<form id="mktoForm_789" style="display:none;">
<script src="//pages.example.com/js/forms2/js/forms2.min.js"></script>
<script>
MktoForms2.loadForm( "//pages.example.com", "123-ABC-456", 789 );
MktoForms2.whenReady( function(form) {
form.addHiddenFields({
Email : "user@example.net"
});
});
});
</script>
The object passed to addHiddenFields uses the form field names, which are the same as the SOAP names.
Thanks Sanford,
So, if I repeat it back to you....
Given that this process is happening downstream from the website page being submitted,
the 'post-form submit procedure' will gather the data from our database, then
inside a php file, we will create a form, adding the data back into hidden fields, then
automatically submitting the form.
If i'm correct, then i only have one more question. Can i pass the anonymous munchkin person id in the form as a data field and will marketo handle the merge? or will i have to do that in another process once i get a success response with the person id?
BTW, if you haven't been told recently, you are appreciated in the Marketo Community.
Given that this process is happening downstream from the website page being submitted,
the 'post-form submit procedure' will gather the data from our database, then
inside a php file, we will create a form, adding the data back into hidden fields, then
automatically submitting the form.
That would work, yes. And it automatically includes the cookie. You don't need to do anything special.
BTW, if you haven't been told recently, you are appreciated in the Marketo Community.
Thanks!
Hi @SanfordWhiteman,
Just curious , how does the form.addHiddenFields() method prevent anyone from creating and injecting data into the form?
form.addHiddenFields({"foo:": "bar", "some_key": "some_value"})
Are the form fields white-labeled in Marketo somehow? Or is there something about the form submission process that prevents this? Forgive me, I'm not great with JS and web security yet but have a client that is concerned with it and would like to give an educated answer. Thank you
I think I answered my own question - data can only be submitted through form fields that exist in the Marketo fields list.
Thanks @SanfordWhiteman. Could you elaborate on what it means to 'set fields for the first time'?