Overview
Forms 1.0 contained the value for the Munchkin tracking cookie as a field in the DOM. This was submitted along with all of the other inputs. Forms 2.0 omits this field, and dynamically populates the value upon submission rather than on form load.
While this is generally acceptable, it does creates a class of use cases, which require the tracking cookie be cleared to avoid unintended tracking and prefilling. For example, this can occur at a tradeshow where a Marketo customer is using the same form on the same device, and getting contact information from multiple people.
The snippet below will allow you to clear the cookie value on submission of the form, without having to delete the cookie itself from the user’s browser.
Code Sample
This snippet expects a single form load on the page. If there are multiple forms, you should use the loadForm or getForm methods to implement your callbacks.
1 2 3 4 5 6 7 8 9 10 11 |
<script> //add a callback to the first ready form on the page MktoForms2.whenReady( function(form){ //add the tracking field to be submitted form.addHiddenFields({"_mkt_trk":""}); //clear the value during the onSubmit event to prevent tracking association form.onSubmit( function(form){ form.vals({"_mkt_trk":""}); }) }) </script> |