You'll find an example in the file index.html attached to this article.
How to integrate it ?
- Integrate the JS script atmt_form_mapper.js in your page:
<script src="js/mautic_form_mapper.js"></script>
- Add the JS variable that will contain the URL of your automation instance:
var urlAutomation = "https://test0719-1.automation.webmecanik.com";
- Add the table that will contain the matching fields of your form with the fields alias of your automation instance:
var mappingFields_form1 = {"civilite" : "title", "name" : "lastname"};
- Then add the onSubmit attribute to the tag of your form that calls the atmt() function.
- It takes as parameters in the order: the form, the table of mapping and the name the automation instance:
<form id="form_test" onSubmit="return form_mapper(this, mappingFields_form1, urlAutomation);">
How to send new data to the Automation instance ?
- Add the input field in your html form:
<input id="nom" name="nom" type="text" placeholder="Nom" required>
- You need to update the matching field. You have to put the ID of the form and as a value, the alias of the automation custom field:
var mappingFields_form1 = {"civilite" : "title", "prenom" : "lastname", "nom" : "firstname"};
- The custom field must exist within automation and it has to be publicy updatable. To make it publicy uptabale, you must go in the edition of the custom field in automation and check YES to make it publicy updatable. *If you checkbox type as input, you need to have the same type of field in automation.
Troubleshooting ?
Nothing happens:
If the new lead does not appear in automation, it may be due to:
- An existing lead has been updated.
- One (or many) false data block the sending to automation:
- An invalide date: a date must be sent as YYYY-MM-DD and must be valid (2016-04-35 is not valid).
- For fields that depends of a select list, the value you send must be in this list.
It misses data:
- If the field does not exist in automation, the corresponding value will not be added to the contact (others fields are taking into account).
- Check that the table of matching fields is correct.
- Check that all the custom fields are publicy updatable.
Comments
0 comments
Please sign in to leave a comment.