How to track UTM parameters and gclid in Gravity Forms

Gravity Forms stores every entry in your WordPress database, which makes it a good base for tracking leads. Out of the box, though, an entry does not say how the person found your site. To judge your ads, your SEO and your social media by the enquiries they bring, you need the source next to each entry.

Here are two ways to get it: with Gravity Forms’ dynamic population, and automatically.

What to capture

When a visitor arrives through an ad or a tagged link, the address carries the campaign:

https://example.com/?utm_source=google&utm_medium=cpc&utm_campaign=b2b-leads&utm_term=crm+consulting&gclid=Cj0KCQ...

The UTM parameters are set by you in your ads and links. gclid is added by Google Ads with auto-tagging and identifies the click; it is what you need to upload offline conversions to Google Ads later. Visitors from organic search, social posts or other websites bring no parameters, only a referrer.

Method 1: hidden fields with dynamic population

  1. Open your form in the Gravity Forms editor.
  2. Add a Hidden field and label it utm_source.
  3. In the field settings, open Advanced, tick Allow field to be populated dynamically and enter utm_source as the Parameter Name.
  4. Repeat for utm_medium, utm_campaign, utm_term and gclid.
  5. Save the form.

Gravity Forms now fills each field from the URL parameter of the same name. The values are stored with the entry and can be used in notifications with merge tags, for example {utm_source:5} (the number is the field ID; pick it from the merge tag list), or with {all_fields}.

To test, open the form page through https://example.com/contact/?utm_source=test&utm_campaign=check and submit an entry.

Where this method falls short

Dynamic population reads the address of the page that loads the form. You lose the source when:

  • the visitor arrives on a landing page and submits the form on another page;
  • the visitor comes back on another day without the campaign link;
  • the visitor found you through organic search, social media or another website;
  • the form is loaded on a cached page whose HTML was generated for another visitor.

Closing these gaps means storing the first and the latest source of each visitor in the browser, reading the referrer, respecting cookie consent in the EU, and putting it all into the fields on submit.

Method 2: automatic, with Dealroot

Dealroot is a free plugin that does exactly that. It remembers how each visitor found your website, saves every Gravity Forms entry as a lead with its source, and fills your hidden fields on the server.

  1. Install and activate Dealroot under Plugins → Add Plugin.
  2. Open Leads → Forms and click Scan site. Your Gravity Forms forms are listed and ticked.
  3. Send a test entry through https://your-site.com/?utm_source=test&utm_medium=cpc and open Leads → All leads.

Every lead shows the channel, the source, campaign, keyword, click ID and landing page of the first and the latest visit, and the pages viewed before the enquiry. Visitors without UTM parameters are sorted by their referrer.

Keep your hidden fields, without dynamic population

If you already use hidden fields for a CRM add-on, Zapier or a webhook, you can keep them. Dealroot fills fields whose parameter name or label is utm_source, utm_medium, utm_campaign, utm_term, gclid or dealroot_channel when the form is sent, from what it remembered about the visitor. Fields that already have a value are left alone.

The source in your notifications

Use the merge tag {dealroot_attribution} in any Gravity Forms notification to add a short summary of where the lead came from. Or turn on Leads → Settings → Forms → Source in your forms to add it below the notification emails of all your forms at once.

Summary

Dynamic population is a reliable way to store the campaign of visitors who submit a form on the page they landed on. For everyone else, a plugin that follows the whole visit fills the gaps. Dealroot does that for Gravity Forms and adds reports of enquiries and revenue per channel and campaign.

See which ads pay for themselves.

Install the free plugin today. When you want your ads to learn from your sales, upgrade in a minute and keep every lead you collected.

Choose a plan Get the free plugin