Gravity Forms
Gravity Forms UTM tracking and lead source capture
Gravity Forms entries hold whatever a visitor typed. The channel, campaign and keyword that brought them live in the URL and the referrer, and neither reaches an entry until you add hidden fields for SourceTag to fill in.
Your website
Script installed
SourceTag
Captures attribution
Gravity Forms
Hidden fields sent
Your tools
Data arrives tagged
Your website
Script installed
SourceTag
Captures attribution
Gravity Forms
Hidden fields sent
Your tools
Data arrives tagged
The problem
Gravity Forms captures what people type into the form. It has no idea how that visitor found your site, or which ad they clicked to get there. That data lives in the URL and the referrer, not in anything Gravity Forms can see on its own.
How to set it up
Add a handful of hidden fields to your Gravity Forms form. SourceTag's script finds them and fills them in the moment someone hits submit, so the channel, click ID and landing page arrive with the rest of the entry.
Get SourceTag running
Install the SourceTag plugin and drop in your Site ID.
Name the hidden fields to match
In Gravity Forms, add hidden fields called st_fc_channel, st_fc_detail_1 and so on. Your SourceTag dashboard has the full list.
Submit one test entry
Load your site with ?utm_source=test&utm_medium=cpc, submit the form, and look for the attribution data on the entry.
The twelve fields to add
st_fc_channel, st_fc_detail_1 through st_fc_detail_4 and st_fc_landing_page cover the first click. The same six with st_lc_ cover the last click. All twelve are always populated, so add every one even if your reporting only uses two or three.
The four detail fields change meaning by channel. Paid Search fills them with utm_source, utm_campaign, utm_term and utm_content. Organic Search puts the search engine in detail 1 and the referrer URL in detail 2. Direct leaves all four as (not set).
st_fc_landing_page keeps the path and query string of the page a visitor arrived on, with UTM parameters and click IDs stripped out, so /quote?ref=nav keeps the ref and drops the utm_source.
Turn on the extended groups in your dashboard if you also want click IDs, raw UTM values, or st_visits, st_days_to_convert and st_device, then add a hidden field for each one you enable. Full field list.
Adding hidden fields in the Gravity Forms editor
The Hidden field type sits under Standard Fields in the form editor. Drag one in for each SourceTag field.
Open Forms > Edit on the form you want to track
Any form on the site works. SourceTag fills whatever hidden fields it finds when the page loads.
Drag in a Hidden field and set the Field Label
Click the field, then set Field Label to the exact SourceTag field name, for example st_fc_channel. Repeat for the other eleven core fields.
Leave "Allow field to be populated dynamically" off
That setting reads a value from a matching query string parameter in the URL. SourceTag writes the value directly with JavaScript at submit time, so turning it on does nothing useful and opens a door for someone to fake a lead source by adding the parameter to a link themselves.
Save and submit a test entry
Forms > Entries shows the stored values next to the visible fields.
Where the values land after submit
Gravity Forms stores every field on the entry automatically, hidden ones included, so nothing extra is needed to keep the data. The default notification template also uses the {all_fields} merge tag, which pulls in hidden field values on its own. If you've rebuilt a notification with individual field tags instead, add tags for the SourceTag fields the same way.
Sending entries to a CRM is a separate step. Gravity Forms has official add-ons for HubSpot, Salesforce, ActiveCampaign, Mailchimp and Zapier, each with its own field mapping screen inside the feed. Map every st_ field there the same way you'd map name or email. A field that exists on the form and in the CRM but is unmapped in the feed arrives empty, and it looks exactly like a tracking failure.
Test it with a UTM link
Load the page with the form using a tagged URL, then open dev tools and inspect the form before you submit.
The hidden inputs should already carry values: st_fc_channel reads Paid Search, st_fc_detail_1 reads google, st_fc_detail_2 reads the campaign name. Submit, then check Forms > Entries for the same values against the new entry.
Fields with nothing in them show (not set) rather than blank. That's how you tell a genuine Direct visit apart from a hidden field that never got filled.
https://yoursite.com/quote?utm_source=google&utm_medium=cpc
&utm_campaign=spring-promo&utm_term=roof+repair+quoteAJAX submissions, multi-page forms and popups
Gravity Forms often submits over AJAX without a full page reload. SourceTag hooks into Gravity Forms' own submission event and refreshes the hidden fields immediately before the entry is created, so the values stay current even on a form that posts without reloading the page.
Multi-page Gravity Forms use one <form> element with pages shown and hidden by JavaScript. Every field, hidden ones included, belongs to that same form regardless of which page it sits on, so add them to page one or the last page, whichever keeps your editor tidy.
A Gravity Forms popup, whether it opens through Elementor Popups, OptinMonster or a similar plugin, is picked up the same way as a form already on the page. SourceTag watches for new elements and fills any hidden fields the moment the form appears.
Where it usually goes wrong
Turning on "Allow field to be populated dynamically". It doesn't break the hidden field, but it invites someone to override the lead source with a query string, which is the opposite of what tracking is for.
A caching or optimisation plugin deferring or minifying st.js. Exclude cdn.sourcetag.io/scripts/ from WP Rocket, LiteSpeed, Autoptimize or whichever plugin you run, then clear the cache. See caching issues for plugin-specific steps.
Renaming a Field Label after wiring up a CRM feed. The feed maps on that label, so a rename breaks the mapping without any error appearing anywhere.
Typing the field name from memory instead of copying it from the Fields page. st_fc_detail_1 with the wrong underscore produces an empty field and no warning.
Where your data ends up
Gravity Forms sends form data to your CRM, email tool, or wherever you've connected it. The attribution data rides along in the hidden fields.
Frequently asked questions
Add a Hidden field for each SourceTag field name under Standard Fields, install the SourceTag script or WordPress plugin, and the values are written into those fields the moment someone submits. No code, and your visible fields stay exactly as they are.
No. That setting reads a value from a matching URL parameter, and SourceTag never uses it. It writes values with JavaScript directly, so leaving the setting off is both simpler and safer, since it stops anyone appending their own value to a link.
Yes. Multi-page Gravity Forms use one form element with pages toggled by JavaScript. The hidden fields belong to that form no matter which page they're placed on.
Yes, if the add-on for that CRM has a field mapping screen, which the official HubSpot, Salesforce, ActiveCampaign and Mailchimp add-ons all do. Map each `st_` field the same way you map name and email.
If the notification still uses the default {all_fields} merge tag, yes. If you've customised it with individual field tags, add tags for the SourceTag fields too.
Yes. SourceTag watches the page for new forms, so a Gravity Forms form that appears in a popup after a delay is filled in the same way as one already on the page.


