If a form on your property uses a non-standard form submission, such as via AJAX, you will need to add a call on the submission of this form to inform DXA that this has been submitted, such as the following:
form in the above example should be replaced with the relevant HTML form element or CSS selector pointing to a form on your website, such as in the examples below:
// Trigger submission of a form identified by DOM element. decibelInsight('formSubmitted', form); // Trigger submission of a form identified by a CSS selector. In this example, it is an ID of contact-form. decibelInsight('formSubmitted', '#contact-form');
An example form can be seen below, which has an ID of contactform. We will use this as part of our form submission.
<form action="submit.php" method="POST" id="contactform" data-di-form-track data-di-form-id="contact"> First name: <input type="text" name="field156" data-di-field-id="firstname"><br /> Last name: <input type="text" name="field135" data-di-field-id="lastname"><br /> <button type="submit" class="btn btn-success">Submit</button> </form>
To trigger the submission of this, you would use the below and target the ID of contactform: