How to Capture UTM Parameters in Gravity Forms?

Marketing Series

We use Gravity Forms to create our lead forms and we placed them on our landing pages. We found that forms are an essential tool to collect sales leads when a visitor is not ready to purchase your service but has very high interest in what your business has to offer.

So if you run digital marketing, you would know how important UTM parameters are and the role it plays to identify which of your marketing campaigns are actually successful.

Hence when a visitor submits a form, you would want to capture the five UTM campaign parameters from the URL address bar which tells you where your visitors originated and whether they are came from one of your marketing campaigns.

But if you came here not knowing what are UTM parameters, you can read all about them on “How to use UTM to track your WooCommerce campaigns?

In the following sections, we will show you 2 methods. The first method which is free uses existing Gravity Forms Hidden Fields but it has a very big flaw. The second method involves using our Gravity Forms Add-on which captures a lot more campaign information.

At the end of this post, you will be able to capture all the UTM parameters including the user’s landing page, first/last touch UTM urls and more.

Table of Contents

Capturing UTM parameters using Gravity Forms Hidden Fields

Since Gravity Forms does not have a built-in support for UTM parameters, you would need to create all the five UTM parameters as individual hidden fields.

  1. Start by inserting a hidden field into your form.
  2. Set the field label to UTM Source.
  3. In the “Advanced” tab, check the “Allow field to be populated dynamically”.
  4. Underneath it, set the Parameter Name as utm_source.
  5. Repeat by creating hidden fields for utm_medium, utm_campaign, utm_term and utm_content.
Gravity Forms hidden field
Gravity Forms hidden field

Save your form and your done. This allows Gravity Forms to populate the hidden fields whenever a visitor visits your form with a UTM campaign url.

Drawback of using this method

If you use the method above, unfortunately it only works well with landing pages with no exit pages.

Meaning that if you have a page with a navigation menu and when your visitors click on a navigation menu to take them to another page and later return to the form, the UTM parameters in the address bar will no longer be there. Hence you won’t be capturing any UTM parameters in the end.

But don’t worry, we have solution for you below.

Capturing UTM parameters automatically using a Gravity Forms add-on

So using hidden fields may not be the perfect solution since it is a troublesome task to create all five hidden fields for all of your forms and there’s a problem where the UTM parameters does not persist when the user exits the page.

Therefore we have created a WordPress plugin that solves all of that and more. The plugin is called WooCommerce UTM Tracker and it nicely integrates with Gravity Forms as an add-on. It is now available on our store.

WooCommerce UTM Tracker with Gravity Forms Add-on

The first step is to install our plugin, activate and clear your page cache. There is nothing to setup for now and it works with your existing form automatically. You do not need to insert any fields because we track and store a user’s visit using the browser cookies. When your visitor submits a form, we store the UTM parameters into the Gravity Form entry meta table.

As you can see in the screenshots below, your Gravity Forms entries table now has snippets of UTM Source / Medium values, Google Ads (gclid) and Facebook (fbclid) visits.

Screenshot of Gravity Forms entries table
Screenshot of Gravity Forms entries table

When you enter into a particular form entry, you will have the complete view of the user’s first visit date, landing page, website referrer, first / last touch UTM urls, Google Analytics Client ID, Google (gclid) and Facebook (fbclid).

Screenshot of Gravity Forms entry
Screenshot of Gravity Forms entry

Isn’t it wonderful that you can even export all your entries with the UTM parameters. Go to the Gravity Forms Import / Export menu. On the Export Entries tab, choose a form which you would like to export the entries.

Screenshot of Gravity Forms export entries
Screenshot of Gravity Forms export entries

Download our WooCommerce UTM Tracker plugin today and track your digital marketing campaigns like a pro.

Comments