Importance of Form Field Tracking and Form Validation

Apart from tracking conversions, newsletter signups and user behavior, think of the most important actions a customer can perform on your site. Registration of a new account, making an inquiry about a product and services, filling out a delivery address and billing information. Each of these extremely important actions is made through forms, which means: Enhancing those forms can have a great impact on your conversions.

To optimize these forms, you have to understand how visitors are responding to them, whether they have trouble inputting a value in any specific form field and what their behaviors indicate. And to do that, you have to monitor / measure their activity on your website or store.

Form Field Data Usage:

When you have access to this type of form data in Google Analytics, you can start to see where you are losing prospective customers, identify why they drop off, and create solid steps towards form improvements that will earn huge rewards.

Data gathered from these form fields can be used to personalize web and marketing efforts, and contribute to customer research. These types of form data can be considered micro conversions and can give important indicators of visitors' motivations.

To avoid form abandonment, ideally you want only eligible leads to fill out the form, but if you add too many qualifiers, even interested users may drop out or leave the form incomplete.

To avoid this outcome, you can use form analytics to determine the form’s effectiveness and remove or change the questions or field data type that cause users to skip or drop out.

Importance of Form Validation:

Form validation is required to prevent web form misuse by malicious users or bot spiders. Improper validation of form data is one of the main causes of security weaknesses.

Validation of form data is based on the data type you specify for each field i.e. only a specific set of characters are allowed and precise validation rules apply when creating a form.

It is important that form owners or developers choose the correct data type for each field.

Selecting an incorrect data type will not pose a security risk, but it may prevent visitors from entering legitimate data.

It exposes your site to attacks such as cross-site scripting, header injections, and SQL injections. Form data validation is not insignificant, because it depends on the context where individual data items are used, and on content encoding.

How to Track Form Fields in GTM

Step1 - Enable form related built in data layer in variables (Variables-->Built in Variables)importance-of-form-field-1Step2 - Set up one Form Submit (gtm.formSubmit) Trigger in GTM.

Step 3 - Capture the field value with a custom javascript variable called “Form Field”. This javascript will capture the value of the form field. The solution below will access the value attribute of the form field with ID inputFormFieldId when the form is submitted. If no such field/ID is found, then undefined is returned instead.

function() {
var field = {{Form Element}}.querySelector('#inputFormFieldId');
return field ? field.value : undefined;
}

Step 4: In the form field tracking tag, use the above variable {{Form Field}} in either the Custom Dimension or in the Label field of event tracking.importance-of-form-field-2With GTM you can enable form filed tracking and set up a form field validation so that only a completely filled-out form is tracked in GA.

If you like my articles,