Come, meet us at Wordcamp, Torino, Italy on 14th and 15th June 2024 Click here
Scroll to top

Gravity Forms Conversion Tracking with Google Tag Manager

Gravity forms tracking

Gravity Forms is a Word Press plugin that allows site owners to create simple or complex forms to collect information. To understand the visitor’s behavior, it is must to track these form submissions. It is an important part of any digital marketing campaign. There are different approaches you can take to start tracking this data and you need to check how your form works after the successful submission. If it:-

  • Refreshes the page or redirects a visitor to a ‘thank you’ page
  • If the page does not refresh after the successful submission

In my case, the form refreshes itself and displays “thank you” message every time a form is successfully submitted. So I need to implement an auto-event listener with a Custom HTML tag. A Gravity Form listener is a function/java script code which listens to particular interactions on a page.

Step 1:  Gravity Forms Listener

Create a Custom HTML tag with the following code. I named it gravityFormSubmission.

Fire it on all pages that have the Gravity form embedded (like contact us). This code technically listens to the gform_confirmation_loaded event which occurs when the confirmation messages is loaded and fire a Data Layer Event, called “gravityformSubmission.”

Step 2:  Create a GTM Trigger

Next is to create a Trigger for the Tag you have created above. In your GTM account, go to Triggers > New > Custom Events

Trigger TypePick the “custom event” from the default list.

Event Name: Enter your custom event value as the event name, e.g gravityFormSubmission

This Trigger Fires On: All Custom Events

Step 3: Configure Data Variable

Navigate to the Variables Section in your workspace, click the Configure button and make sure every page and form variable box is checked.

Create a Data Layer variable called formID to pass its value to Google Analytics. It’s useful if you have more than one gravity forms on a page or a website.

Go to Variables > New > Choose variable Type>>Choose built-in Data Layer variable name.

Next, I will create Google Analytics Event tag and set it to fire on the gravityFormSubmission trigger created above.

Step 4: Google Analytics Event Tag

Now, navigate to the Tag section and add a new tag. Choose a name for your tag and select Universal Analytics as the tag type.

Select Event as the track type.

For category, use a name to describe your form whatever you want. I named it “contact form.”

Set the Label as form-id-{{GFformID}, if you want to track different forms separately.

Next, I set the non-interaction hit to False. The session will not get counted as a “Bounce” by keeping the non-interaction hit on “False”.

 For Action,I choose the name gfsuccessful-form-submission.(it can be any name)

The Google Analytics Tag will look like this after filling all the values:-

Assign “Gravity Form Submission” event trigger just created above and press save.

Test your forms and make sure your event is triggered properly. Preview your container to make sure the tag fires, when you fill out the form on the site. Once everything is working fine move ahead and Publish.

Now, move on to Google Analytics Goal configuration.

Setting up the Goal Conversion

In Google Analytics navigate to Admin > View > Goals. Click +New Goal and set it up like this:-

Goal Description:

Name: Name the Goal as I named Gravity Form Submission.

Type: Select Event

Action: Equals to > gfsuccessful-form-submission

Label: Select the form ID of the form you want to track. If you want to track different forms separately, fill the Label field.

Save the Goal Conversion and you’re done. Repeat the process If you want to set up other goals for different form IDs but need to change the Label in the Goal Conversion. Don’t forget to check Google Analytics Real-time Event reports as all successful form submissions are visible there.

I hope that this blog was useful and helped you to track Gravity Forms with Tag Manager in easy ways.

If you are looking for a SEO Company with a team of experienced professionals who could setup all these conversions for your website and to become your long term partner to handle your Online Reputation Management and succeed business online then we would love to hear from you.

Author avatar
Public advisory against the common scams. Click to read more.