Ever since I wrote the blog on Advanced Form Tracking (tracking abandonment of multi-step form), I wanted to do one for a simple one page form. However, I didn’t want to stop it there, so decided to spice it up a bit more. On this post we’ll hack GTM & GA to track how visitors are engaging with the form before abandoning it.
Here is the form we are going to be tracking the engagement.
Here are the four simple steps to making the magic happen,
Step 1: Track every change in the form field, and store it into session storage.
Step 2: Push the interaction data from session storage into Data Layer when the user navigates away
Step 3: Configure Google Tag Manager to capture all the data and pass it as an event into Google Analytics.
Step 4: Modifying the script from step 2 to ensure the event is fired only when the form is abandoned (note: if you decide to measure only form interaction, you can skip this step)
Step 1: Track interaction data and keep it in session storage
// Instruction to say that we are going to track the form.
Personally, I am a big fan of Google Analytics (GA). Even more when set up with Google Tag Manager (GTM). GA is the most obvious choice when you do not want to splurge hundreds of dollars on tracking tools such as Kissmetrics and Mixpanel. They are indeed great tools for marketers, but one can always hack GA to work in par with those. I recently hacked GA/GTM to track form abandonment on a multi-step form. Let’s dig through to see the challenge and how I hacked my way through it.
Tracking form abandonment has become much easier with GTM, provided you have a simple/standard form. However if you have a dynamic form, where the form fields change dynamically based on what the user was looking for (basically we are looking at numerous forms that have different number of fields in each), we’ll need a hack to make it work on GA. Here is a glimpse of one such form (you can find this on www.zaask.pt/canalizadores), where just one question is presented at a time.
Form: Step 1
Form: Step 2
One easy way I found to address this was using SessionStorage (more about it in a future article. For …