I would like to track the form submission using DTM. If we use event based tracking how can I check if all the form fields are validated before tracking submission button? How these types of logic are added in DTM?
There's a couple of ways you could do this.
You need to ensure that the validation script is loaded before the submit button code. You can create another rule for this or add a sequential third party tag within the same rule
The other (slightly complex-er) method would be to use data elements. This data element will contain the value of the validation script i.e. T or F. Once this data element is set up, you can reference this in your original rule using custom scropt and check the value of the data element to fire your submit button rule accordingly.
I'd suggest trying the 1st method and if it doesn't work, use the 2nd (merely because the 1st one seems a little easier)
Let me know if this helps
I understood that you're looking to track the 'submit' button. However, there's no 'standard' way of tracking forms
What I'd need from your end is details on how you'd be validating the form. As in, are there text fields on your form that you'd validate for correct input/ input present or if there are check boxes that you'd validate are checked and so on.
Tracking would probably be thru a straight forward event based rule but the complexity arising from your desire to validate can only be addressed if you let me know how you're defining 'validation'
Please let me know if this makes sense.
I understood that you wanted to track the submit button of a form. However, I'm not aware if there's a 'standard' way of tracking forms.
what I need from your end is how exactly you validate the fields in your form. In the sense, if it's a text field do you validate whether the input is present or not or if there's a check box, do you check whether the box is checked or not.
The tracking of the submit button would probably be thru a straight forward event based rule but validation of these fields would depend on how you'd like to define 'validation'
I hope I'm making sense here.
Please let me know.
I want to track the submit button of a form. Before that i want to make sure that all the fields are validated. I mean all the mandatory fields have the proper values added. Only then i can track the submit button. I want to know where can we put that piece of code.
If you can let me know the standard way of tracking form using DTM would be helpful. Then i can let you know my requirement.
Let me know you need any other information.
Sorry for the delayed response.
Please help me out with the details of your validation of the form fields?
As in, what do you mean by validated ? Validated because there is a value in the field ? Validated because there is a green checkbox next to the field ?
Let me know