Do you know how many people start completing forms on your website, but don't complete them? Do you know which fields cause them difficulties? This is a guide to field-by-field form tracking using GTM.

Tracking form fields and form submits in gtm v2

By tracking each element of the form separately, you will see how many people start filling out the form but then decide not to submit it.

Once you understand where people drop off you will be able to identify any parts of the form that may need improving.

The enquiry form on our website has four elements that I am going to track: the name, email and subject fields, and the button to submit the query.

In summary, the set up will work like this:

  • Create a trigger that will act as the firing rule for the tag
  • Create a tag to track clicks on the field
  • Repeat for each field

So to set up the tracking of form fields and submits in GTM V2, follow these steps.

Enable built in variables

Firstly, you will need to enable built in variables.

You will need Form ID variable and if similarly to our site you have the same enquiry form placed on several pages, then Page Path variable as well.

These variables will allow you to track clicks on the form and on which pages the form was clicked on.

The page path variable returns the URL part that comes after your main domain, eg /blog.

enable built in variables

Create the trigger

For your trigger, you will need to find out the field ID you want to track.

To find out the ID, if you are using Chrome browser, right-click on the field and select ‘Inspect Element’

It will look something like id=”name” so name here is the unique ID that you need to use with the trigger.

find out form field id inspect element

If you do not have a unique ID associated with the field you want to track, ask your developers to add it in. This will make the tracking much easier.

Now in GTM, go to Triggers tab on the left and click 'New'. You are creating a 'click' trigger, which you want to fire on 'all elements'.

trigger to track clicks on form field name gtm v2

Save the trigger.

Create the tag

Go to Tags tab and click 'New'.

Select Google Analytics and tag type 'Universal Analytics'.

tracking enquiry form in gtm

I send the following event tracking parameters to GA:

Category: Enquiry form

Action: Click on name

Label: {{Page Path}}

Now select 'Click' to select the trigger ‘Click on name’ as your firing rule.

set the firing trigger for your tag gtm

If there are any pages where you don’t want this tracked, then you will need to create a separate blocking trigger.

Here is an example of a trigger for a contact us page that I want to exclude from tracking here.

blocking trigger for gtm v2

You can create your blocking trigger in a pop up window without leaving the tag.

Repeat

Follow the steps above to create the trigger and tag for each following field, and amend form ID’s and event field values for each.

Test your tags in GTM debug mode and GA real time to make sure the details sent through are what you want.

Once tested, publish your container and if you need any further help with any of the above, leave a comment below.

 

Further reading: