How to Capture UTM Parameters in a Cookie

By: Dan Umbro

November 17, 2022

Get a Complete View of How Leads are Getting to Your Site Using Handl UTM Grabber and Gravity Forms

Understanding where leads originate is a common challenge marketers face. Knowing information about where leads came from or what campaign they engaged with helps marketers evaluate their efforts for future work. 

For that reason, most marketers are familiar with UTM parameters, which I’ll cover below.

Most marketers don’t realize that they can take their traditional tracking efforts to the next level by using cookies to store information about leads. In fact, I would argue that if you’re not using cookies then you are potentially inaccurately reporting on your web leads.

What Are UTM Parameters?

Before getting into the weeds, I think it’s important to understand exactly what UTM parameters are.

When constructing a URL you can use a parameter to pass information about the click through a URL. In this case, we’re talking about UTM parameters, or five unique parameters that Google Analytics uses to track traffic coming to your website. These are:

  • utm_source: Used to identify from where a user got to your website; for example, search engine, newsletter, or social media site.
  • utm_medium: Used to identify from which channel a user got to your website, for example, email or cpc.
  • utm_campaign: Used to identify which campaign a user engaged with to get to your website; for example, product promotion or blog post.
  • utm_term: Used to identify what keywords were targeted in a paid ad campaign.
  • utm_content: Used to identify which content was used in the link, typically to differentiate content that points to the same URL.

Another common parameter used for tracking is “GCLID” which stands for Google Click Identifier. This is used to identify the campaign and other attributes of a click associated with Google Adwords tracking.

Google Support provides detailed documentation on collecting campaign data with URLs.

Here’s an example of a link I may use to promote this blog on my LinkedIn page:

You can see that I have identified the source, medium and campaign but didn’t include the term and content parameters because they weren’t applicable here.

Why It’s Important To Use a Cookie to Capture UTM Parameters

In the example above, let’s pretend someone clicked through to my blog post then went on to fill out a web form. I’d be able to see the traffic in Google Analytics and I would know that a form was completed using those parameters.

Any interaction beyond that wouldn’t be tied back to those parameters though.

Pretend that same individual went on to engage with Fishnet Media and eventually turned into a client. Even though we know someone viewing my LinkedIn post filled out a form, we wouldn’t know that they eventually converted into a client.

That’s where cookies come in. If you use a cookie to store those UTM parameter values, you can append them to the form submission.

A cookie will follow the user around your website, no matter what page they land on. It can also be stored for a future visit. When they do decide to take action and fill out a form, it will be collected as part of their submission.

Best Practices to Capture UTM Parameters

It’s best practice to tag URLs with UTM parameters in any outbound effort. They will help you uncover valuable insights about your marketing efforts and what is bringing traffic to your website.

For reference, I use this tool to generate my URLs.

Here are some common examples where you would use a UTM parameter:

Email – In many email marketing clients, UTM parameters are added by default. Still, it’s best practice to build URLs with UTM parameters wherever you can to track performance.

Banner Ad – In scenarios where you’re linking back to your website from somewhere else, it’s best to provide a tracked URL if possible. A tracked URL is especially useful if you’re paying for multiple ads on a website and you want to understand which ads are most effective.

Paid Ads – When using services like Google Adwords, where you can really segment how you place ads, it’s very helpful to track performance. After all, wouldn’t you want to know if specific ad content or keywords led to more revenue than others? Then you could allocate more spend to the ads that convert best.

Social Media – It’s easy to forget UTM parameters when it comes to social media posts, but these are just as important to track as other channels. Social media tracking is especially important for companies that are putting a lot of time and effort into crafting social content.

How to Use Cookies to Store UTM Parameters

There are a few different ways to use cookies to store UTM parameters. The makeup of your tech stack will determine how you can implement a strategy.

In most scenarios, you can use a combination of Google Tag Manager (GTM) and any form tool. Here’s a resource that outlines a no-code solution using GTM. When looking at that link, keep in mind that you would still need to map the values stored in a cookie to a form.

At Fishnet we use a tool called Handl UTM Grabber in combination with Gravity Forms. It works well and is very easy to implement.

Handl UTM Grabber for Gravity Forms

Here, I’ll outline the steps to configure Handl UTM Grabber with Gravity forms. It’s worth mentioning that you can use another solution like Contact Form 7 if that’s what your site utilizes already.

1. The first step is to download and install the WordPress plugin, which is free. Once installed, the plugin is activated and it automatically begins to store UTM parameters in the client’s browser.

Upon activation of the plugin, it will fill elements automatically (by element name, ID, and class) for the following:

  • utm_term
  • utm_content
  • utm_campaign
  • utm_medium
  • utm_source
  • gclid

If you are already using any of those names in your form element name, ID, or class, then the values in your UTM parameters will map to those fields. If you aren’t, then all you need to do is update one of those to map the fields. 

2. Mapping the cookie values that Handl stores is straightforward with Gravity Forms. You will need to create hidden fields for each utm_parameter you wish to store. As part of this step, you will need to make sure that you check off “Allow field to be populated dynamically” and then input the utm_parameter name (ex. utm_source). Here’s what that action would look like in Gravity Forms:

All of these fields are hidden, meaning the user won’t see these on the front-end. As long as there is a cookie value stored for any of these fields, the data will map on form submission.

3. Next, you will want to see if the configuration is working. Visit any website page, using a URL with UTM parameters. In my example, I used a URL from earlier:

Then go to the page where your form lives and inspect the code. You should see something similar to this:

In the image above, the values stored in each field map to the UTM parameters I used in my example. When I submit the form, a new record will be generated that I can tie back to these parameters.

If you are using a CRM or similar service, you can now append this information to that lead. Tracking can be followed back to the original UTM parameters, even if multiple pages were visited during the session before completing the form.  


As you can see, there’s not much effort needed to configure a cookied UTM tracking solution. All we did was install a plugin and create hidden fields mapping to each parameter we want to track. 

The only difference between this solution and what most marketers would normally do is the Handl plugin, which is free. 

Again, the major benefit of taking advantage of cookies is that you can track your website visitors’ UTM parameters beyond the first page of your website that they land on. There is potentially a huge gap in your tracking if you neglect to capture this data past the landing page.


I came across a few common questions when researching this blog post, so I thought I’d share them here for others.

What does UTM stand for?

Commonly used in digital marketing to track campaign performance, UTM is an acronym that stands for “Urchin Tracking Module”. 

What is the Urchin Tracking Module?

The Urchin Tracking Module (UTM) is a technology that provides accurate measurement of unique website visitors. The technology allows for identification of unique visitors, click paths, and other variables related to website traffic.

What is the Handl UTM Grabber?

Handl UTM Grabber is a WordPress plugin for tracking UTM parameters with cookies. There is a free version that includes tracking for the five main UTM parameters and the GCLID. Additionally, there is a paid version that allows for custom parameter tracking and longer cookie storage, among other features.

Subscribe to Our Newsletter

Dan Umbro

I've been at Fishnet Media for more than six years and manage all our automation-related tasks. I'm responsible for establishing best practices for our clients with their marketing technologies and processes, and it's not uncommon for me to assist them with the development and execution of multi-channel marketing campaigns. Additionally, I'm the lead on all Pardot implementations, audits, strategic initiatives, and custom solutions. I hold certifications as a Pardot Consultant, Specialist, and Salesforce Administrator.

Related Blog Posts: