Log in to your account
Sign up

How To Track Gravity Forms In WordPress With GTM

05 February 2021 | 0 comments | Posted by Che Kohler in nichemarket Advice

Tracking gravity forms with GTM

Creating a lead generation site for your business using WordPress has become so easy in recent years with the help of form plugins like Contact Form 7, Caldera forms and of course, Gravity forms.

Gravity forms is one of the most popular form plugins used by WordPress website owners today. Setting up a form, creating custom fields and injecting into a page is so simple. However, one area people tend to find issues is tracking form completes and passing them on to Google Analytics.

Like everything WordPress related, there are several ways to tackle this issue. We've put together several methods you can use, depending on your current tracking set up or skill level.

Each method has it's own trade-offs, so be sure you're comfortable with the method's shortcomings before taking it on.

Thank you page method

In terms of simplicity of implementation, this has to be the easiest of all the options. What you would need to do is create a new page in your WordPress CMS.

Customise it with your sites look and feel, write a thank you response in the page body and provide an easy and unique URL slug.

For example - https://www.nichemarket.co.za/thank-you

  1. Once you've created the URL, head over to your gravity forms plugin
  2. Edit the form
  3. Click settings
  4. Select confirmation
  5. Under confirmation type, page or redirect
  6. Assign it to the new thank you page you created

Head back to your site and test that once you completed the form, that it automatically redirects you to the new "thank you" page.

Now you could finish up early by setting up a goal directly in Google Analytics.

  1. Open up your Google Analytics
  2. Click settings
  3. Navigate to view and under view click on goals
  4. Give your goal a name.
  5. Under Goal description, select "destination."
  6. Under Goal details add the slug of your URL - IE /thank-you
  7. Click Done

What this will do is capture each time the thank you page is loaded as a conversion/goal. This can cause data discrepancies, as users may reload the page firing the page view twice, or in some cases find it through other methods.

Note: If you are going to use the thank you page method, please ensure that the thank you page is set to no-index, no-follow. That way, it won't be indexed by Google or Bing. You never want a user to hit your thank you page other than after completing the form.

Page view method + Google Tag Manager

If you're still keen on this method but want to keep track of the discrepancy rate, I would suggest using Google Tag Manager instead. Instead of going directly to Google Analytics, after you create the thank you page, head over to Google Tag Manager first.

Setting up the tag

  1. Create a new tag
  2. Select Google Analytics Universal Tag
  3. Select event tracking
  4. Add an event Category IE - Forms
  5. Add an event Action IE - Form completed
  6. Add your GA ID

Setting up the trigger

  1. Set up the trigger
  2. Select page view trigger
  3. Set to fire on some pages
  4. If page URL > Contains > /thank-you
  5. Save the trigger and tag and fire

Setting up the goal

  1. Open up your Google Analytics
  2. Click settings
  3. Navigate to view and under view click on goals
  4. Give your goal a name.
  5. Under Goal description, select "event."
  6. Under Goal details add the category and action you set in the trigger.
  7. Click Done

Now you will still have the same data you would get previously, but you can compare it with event tracking data and review how many unique events vs total event there were, as well as which days caused issues in tracking.

Plugin method

If you're not a fan of having a thank you page and prefer the thank you notification rendered in the same page, opting for a plugin is your next option.

You can use one of these three plugin options:

Custom listener method

If you're using an older version of gravity forms, prior to 2018, this method may still be applicable to you. This is a technical workaround by Analytics Mania uses a custom HTML listener to push a form submission event into the data layer.

You can find the detailed instructions here.

Google Tag Manager element visibility method

If you're using a new version of gravity forms, then this method could work for you. Using Google Tag Managers element visibility trigger, we're going to fire a form completely when the thank you message is displayed don the screen. Start by heading over to Google Tag Manager and creating a variable, trigger and tag.

Create a new variable

  1. Select variables
  2. Scroll down to the bottom
  3. Under "User-Defined Variables" click new
  4. Give the variable a name - IE - Form Confirmations Variable
  5. Under variable type select "DOM Element"
  6. Under section method select "ID"
  7. Under element ID input the text "gform_confirmation_message_1"
  8. Click save

Create the tag

  1. Head over to tags
  2. Click new
  3. Select Google Analytics: Universal Analytics
  4. Under track-type - Select Event
  5. Under Category give it a name - IE - Contact Form
  6. Under Action give it a name - IE - Form Submit
  7. Add your GA tracking code

Creating the trigger

  1. Under Trigger type select - "Element Visibility"
  2. Under selection method select - "ID"
  3. When to fire this page, select Once per page
  4. Check the option - Observe DOM changes.
  5. Under this trigger fires on select - "Some Visibility Events"
  6. Set the trigger to the custom variable you created earlier, the one we called "Form Confirmation Variable
  7. Set the condition to "contains"
  8. Add the exact text that displays in your forms are submitted - IE - "Thank you for contacting us

Setting up the goal

  1. Open up your Google Analytics
  2. Click settings
  3. Navigate to view and under view click on goals
  4. Give your goal a name.
  5. Under Goal description, select "event."
  6. Under Goal details add the category and action you set in the tag.
  7. Click Done

Track your gravity forms with ease

We hope this tutorial was helpful, and you could find a method that worked for you. If you are still having trouble with your tracking or have a more complicated set up with multiple forms or conversion funnels, you may want to speak to us directly to assist you.

Contact us

If you are having trouble setting up the contact forms on your website, contact us here, and we'll be happy to assist. 

Are you looking to promote your business?

South African Business owners can create your free business listing on nichemarket. The more information you provide about your business, the easier it will be for your customers to find you online. Registering with nichemarket is easy; all you will need to do is head over to our sign up form and follow the instructions.

If you require a more detailed guide on how to create your profile or your listing, then we highly recommend you check out the following articles. 

Recommended reading

If you enjoyed this post and have a little extra time to improve your skills, here are some related posts on all things WordPress.

Tags: WordPress, Google Tag Manager, Gravity Forms

Previous: {{ previousBlog.sTitle }}

Posted {{ previousBlog.dtDatePosting }}

Next: {{ nextBlog.sTitle }}

Posted {{ nextBlog.dtDatePosting }}

You might also like

Voip security practices

Secure Communications With VoIP Security Best Practices

02 May 2024

Posted by Sienna Martin in Alarming

If you are using VoIP for your business communication, consider these best practices to ensure you protect your business communications and customers

Read more
Revolutionizing Outreach: How to Transform Digital Communication Strategies

Transforming Your Business With Effective Outreach

10 May 2024

Posted by Roman Kamchatnyi in Industry Experts

Improve your outreach efforts and stay ahead in the competitive landscape in your current niche by building high-quality links that will anchor your ...

Read more

Leave us a comment


{{comment.iDayLastEdit}} day ago

{{comment.iDayLastEdit}} days ago


Sign up for our newsletter