Form tracking in Google Analytics


*This plugin has now been updated to the Form Analytics plugin V2.

As mentioned in my last post on Event tracking in Google Analytics, form field tracking is something Google Analytics has always lacked in. Being able to visualise exactly where visitors are dropping out of your forms and being able to work out why is key to any form optimisation project.

To make form tracking easy, I’ve created a script to automatically track form drop off and time spent in each field using event tracking in Google Analytics. Read on to see how it works and to download it.

Or download it here: form-tracking-google-analytics

While tools like ClickTale offer form analytics, a lot of the time ClickTale is too expensive or it’s just nicer to have it all in one place in Google Analytics. The problem is, that while tools Like ClickTale track form interactions automatically, to set this up in Google Analytics requires additional tracking codes.

Recently, I’ve been trying to replicate the two reports in ClickTale that I find most useful in form analytics:

  • Form field drop off
  • Average time per field

These are both reports that have led to considerable success in form optimisation for me in the past.

Form field drop off:

Here we have two options; either each form field can be tracked using a virtual page view, allowing for a funnel visualisation to be set up showing the drop off, or each field can be tracked with an event track. While virtual page views would appear to be the more desirable option because of the ability to set up funnel visualisations, you then have to work out the best way of dealing with the potentially hugely inflated page views count. You could create a separate profile for this report and exclude the virtual page views from the other profiles but this means switching between profiles to access different reports which I’m not a fan of.

So, I’ve stuck with event tracking, which gives us the data to be able to find the key areas of drop off and if we want to create a funnel visualisation, this can be done in excel or similar.

Average time per field:

The average time per field report tries to help answer the “why” of the drop off report. If visitors are spending a significantly longer time on one field than others, it is most likely because they are struggling to fill it out. This was a slightly trickier report to produce, but actually is made easier by using event tracking for the drop off report instead of virtual page views as mentioned above.

It is done by creating a function that takes the time when the user enters the form field and subtracts it from the time when the user exits the form field. This value is then rounded to the nearest second and entered into the value field of the event used in the drop off report above. This kind of form tracking has proved invaluable in working out why forms are under performing.


Clearly, adding this code onto each form field on each form would take too long and would never be implemented. So, I have created a simple JQuery script that automatically tags all form fields on a given page, capturing the page title, form field name, whether data was entered in that field and then the time spent in that field. So the basic syntax for the event looks like this:

Category: Form: Page title

Action: Field completed

Label: Field name

Value: Time spent in field in seconds

And the event label report in Google Analytics looks like this:

Google Analytics form field tracking

Google Analytics form field tracking


You can download the plugin below, free to use, share etc. Just link back if you find this script useful and let me know if you have ideas for how to improve it or other reports that would be useful.

To install:

  • Requires JQuery to be installed – paste this line of code in the head of your page: <script src=”//”></script>
  • Link to the JavaScript file below beneath the call for JQuery and your Google Analytics Tracking code.

Download: form-tracking-google-analytics

Form Field plugin for Google Analytics

7 thoughts on “Form Field plugin for Google Analytics

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>