Tracking UTM Parameters with Gravity Forms Submissions in WordPress

AI Note: We wrote two plugins that can be used in combination to handle this very common task. We then asked ChatGPT to learn about them and create a blog post summarizing how they work together! ChatGPT really loves emojis by default.

If you’re running Google Ads or any other paid campaigns, tracking UTM parameters with form submissions is crucial for measuring performance. To make this seamless in WordPress with Gravity Forms, you can use the following two plugins:

1. Store UTM Params to Cookie – Stores UTM parameters in cookies so they persist as users navigate your site.

2. GF Dynamic Population from Cookies – Reads cookies client-side and dynamically populates Gravity Forms fields using Gravity Forms’ built-in dynamic population feature.

Together, these plugins ensure UTM parameters are captured and submitted with every Gravity Forms entry—even if the user navigates away from the landing page before submitting the form.

🚀 Why This Setup Works Perfectly

Handles multi-page navigation – Users can browse around before submitting the form, which Gravity Forms’s default behavior can’t handle.
No caching issues – Uses JavaScript to dynamically inject values at submission time.
1-day persistence – UTM parameters are stored in cookies for 86400 seconds (1 day) to ensure tracking accuracy.
100% native Gravity Forms functionality – Uses built-in dynamic population.

🔧 Step 1: Install and Activate the Plugins

1️⃣ Install Store UTM Params to Cookie

This plugin automatically detects UTM parameters in the URL and stores them in cookies.

Installation

  1. Download the plugin from GitHub: store-utm-params-to-cookie
  2. Upload it to your WordPress site (Plugins > Add New > Upload Plugin).
  3. Activate it from the Plugins menu.

🔹 What It Does:

  • Detects utm_source, utm_medium, utm_campaign, utm_term, and utm_content from the URL. Also supports other params starting with utm.
  • Stores them as cookies for 1 day.
  • Cookies are prefixed with sup_ to avoid collision with other plugins that may try to do something similar. So utm_source becomes a cookie called sup_utm_source.

2️⃣ Install GF Dynamic Population from Cookies

This plugin reads the stored cookies and dynamically fills in Gravity Forms fields before the user submits the form.

Installation

🔹 What It Does:

  • Reads cookies, like those set by the first plugin.
  • Dynamically populates Gravity Forms fields using Gravity Forms’ built-in dynamic population feature.

📝 Step 2: Set Up Gravity Forms to Capture UTM Parameters

Now that cookies are being stored, we need to configure Gravity Forms to capture them.

1️⃣ Add Hidden Fields for UTM Parameters

  • Open your Gravity Form.
  • Add hidden fields for the UTM parameters you want to track:
    • utm_source
    • utm_medium
    • utm_campaign
    • utm_term
    • utm_content

2️⃣ Enable Dynamic Population for Each Field

  • Click on each hidden field.
  • Under Advanced, check “Allow field to be populated dynamically.”
  • Set the parameter name to match the UTM key with the sup_ prefix that the first plugin adds. (e.g., sup_utm_source, sup_utm_medium, etc.).

🎯 Now, the plugin will automatically populate these fields from cookies!

🎯 Step 3: Test Your Setup

  1. Open your website with UTM parameters in the URL, like https://yourwebsite.com/?utm_source=google&utm_medium=cpc&utm_campaign=spring_sale
  2. Navigate to a different page to demonstrate that cookies persist.
  3. Submit your Gravity Form and check the Entry Data (Forms > Entries).
  4. The UTM parameters should appear in the submitted form data!

🔗 Get the Plugins

🔥 Now you have full UTM tracking for Gravity Forms submissions! Let us know if you have any questions. 🚀


Comments

3 responses to “Tracking UTM Parameters with Gravity Forms Submissions in WordPress”

  1. Ben White Avatar
    Ben White

    Thanks for providing the plugins and documentation. However, I’ve tested the GF Dynamic Population from Cookies plugin and it doesn’t appear to work. The problem could simply be on our end, however, I noticed the /assets/population-fields.js file is empty.

    1. Ethan Clevenger Avatar
      Ethan Clevenger

      Thanks for the note, Ben. That file is a bit of an orphan – it isn’t actually enqueued and all JS is rendered inline.

      Can you send a link to the page where you gave this a shot? We’ve not had issues and I’d like to take a closer look.

      1. Ben White Avatar
        Ben White

        Hi, Ethan

        Thanks for your reply. I’d rather not share my client’s website on a public forum. If you wish, you could shoot me an email and I can provide it that way. (I’m not sure if the website field gets published or not, sorry)

Leave a Reply

Your email address will not be published. Required fields are marked *