How to Track UTM Parameters in HubSpot Forms
See which campaign sent each HubSpot form lead. Add one script tag to the page with the form, then test with a UTM link.
- Author
- SourceTrack Team
- Category
- Track UTM Parameters
- Read Time
- 05 Mins read
- Published Date

Inside the page
- How HubSpot handles UTM parameters on its own
- What SourceTrack records for each HubSpot form lead
- Step 1: Add the script tag
- Step 2: Put your HubSpot form on a page
- Step 3: Open a test link with UTMs
- Step 4: Look at the lead in SourceTrack
- Common problems and fixes
- Further reading
- Frequently asked questions
- Do I need hidden fields in HubSpot to use SourceTrack?
- Does SourceTrack write attribution into HubSpot?
- What if my HubSpot form is in an iframe?
- What if a visitor comes without a UTM link?
- Why did my HubSpot test lead not show up?
- Next step
A HubSpot form brings in a contact, and HubSpot tells you a good deal about that contact. But when you run ads, emails and social posts at the same time, you still want to know which one sent this person. This guide shows how to add that answer with one script tag, while your lead data stays where it is.
How HubSpot handles UTM parameters on its own
HubSpot has two relevant tools, and both are worth understanding before you add anything.
The first is the hidden field. According to the HubSpot knowledge base, a form field can be hidden, and hidden fields can capture URL parameters, such as utm_campaign, and store them as contact properties when the form is sent. In the form editor you hover over a field, open its edit icon and turn on the Hidden field toggle, then set what it should hold. HubSpot’s page on this notes that a field set as required cannot be hidden. It also says that if “Pre-populate fields for returning visitors” is on, a hidden value may be overwritten, depending on the property’s field type.
The second is auto-population from a query string, which HubSpot describes in a separate help page. For this route you create a property for each tag, such as a custom utm_source property, add it to the form as a hidden field, and let the link fill it. For the exact property names and formatting rules, check the vendor documentation.
This works for a lot of teams. It falls short in a few places:
- Setup per tag and per form. Every UTM you care about needs a property and a hidden field. Miss one and that form saves nothing for it.
- A single page view. A hidden field holds the value from the address when the form loaded. If the visitor read three pages after the ad click, the tags are no longer in the address.
- Only what you passed in. A hidden field cannot tell you that a visitor first arrived from a search engine and came back later through an email.
What SourceTrack records for each HubSpot form lead
When someone sends a HubSpot form that sits in your page and your page carries the script, the tracker records the submit and links the lead to the visit that brought them. For each lead you can see:
- UTM parameters:
utm_source,utm_medium,utm_campaign,utm_contentandutm_term. - Ad click IDs:
gclidfor Google Ads,fbclidfor Meta Ads,msclkidfor Bing Ads,li_fat_idfor LinkedIn Ads andttclidfor TikTok Ads. - Referrer and landing page: the site that sent the visitor and the first page they viewed.
- First touch and last touch: both appear in the lead’s touchpoint timeline.
None of this needs a hidden field, because it comes from the visit and not from the form. SourceTrack does not write these values back into HubSpot properties. Your contact stays in HubSpot, and the campaign story sits in SourceTrack.
HubSpot forms can also appear in an iframe. The tracker can listen for HubSpot’s own form-submitted event and record just the form id, but that capture is still being rolled out, so treat it as something to test, not something to count on.
Step 1: Add the script tag
Copy your one script tag from SourceTrack. Paste it into the head of your website, once. The install guide shows where it goes. If your HubSpot form sits on a page that HubSpot itself hosts, check the vendor documentation for how to add a script to that page. If the form is embedded on a site you control, add the tag there.
Step 2: Put your HubSpot form on a page
Embed your HubSpot form on a page of your site as you normally do. SourceTrack records a form that renders directly in your page. You do not need to add hidden fields for SourceTrack to work. Keep the ones you already have if you want values stored in HubSpot too.
Step 3: Open a test link with UTMs
Open your page with UTMs on the end of the link, like this:
https://yourwebsite.com/contact?utm_source=test&utm_medium=email&utm_campaign=form_test
Open it in a new private window. If your browser sends Do Not Track or Global Privacy Control, SourceTrack respects that and will not track the visit. Fill in the form with a test email and send it.
Step 4: Look at the lead in SourceTrack
Open SourceTrack and find the new lead. Check that the source, medium and campaign match your test link. Then open the contact in HubSpot and see what HubSpot recorded for the same submission. Comparing the two is the quickest way to see where each tool helps.
Common problems and fixes
- Nothing shows up at all. View the page source and check that the script tag is inside the head. Then open your browser’s developer tools, choose Network, filter by
trackand reload. A successful request means the script is running. - Do Not Track or Global Privacy Control is on. SourceTrack respects both. If your browser or an extension sends either signal, the tracker does not run, and your test visit will not appear. Test in a browser without them.
- The form sits in an iframe. The page script may not see a submit from inside another frame. Test it, and see the troubleshooting guide if the lead is missing.
- Everything shows as Direct. The visit had no tags and no referring site. Tag the links you control. The troubleshooting guide has more.
Further reading
- HubSpot Knowledge Base: Set property values with hidden form fields: using hidden fields to capture URL parameters such as UTM values into contact properties.
- HubSpot Knowledge Base: Understand Original and Latest traffic source properties: how HubSpot records a contact’s first and most recent traffic source.
- Google Analytics Help: URL builders, collect campaign data with custom URLs: how UTM parameters are added to destination URLs so Analytics can attribute traffic to campaigns.
- How to track UTM parameters in Typeform: the same set-up for Typeform.
- How to send lead source to your CRM: what a CRM needs once the source is captured.
Frequently asked questions
Do I need hidden fields in HubSpot to use SourceTrack?
No. For a HubSpot form that shows on your page, you do not change the form. SourceTrack links the lead to the visit that brought the visitor. You can still keep hidden fields in HubSpot if you want the values saved in your HubSpot records.
Does SourceTrack write attribution into HubSpot?
No, not today. Your lead data stays in HubSpot, and SourceTrack shows the campaign details in its own dashboard. Compare the two when you review a lead.
What if my HubSpot form is in an iframe?
A form inside an iframe submits in its own frame, which the page script does not always see. The tracker can listen for a HubSpot submit event and record the form id, but that capture is still being rolled out, so test your page before you rely on it.
What if a visitor comes without a UTM link?
SourceTrack still looks at where they came from, such as a search engine or another website. If the link has no tags and the visit has no referring site, it shows as Direct. So tag the links you control, like emails, ads and social posts.
Why did my HubSpot test lead not show up?
First, check that the script tag is on the page with the form. Second, try a private window that does not send Do Not Track or Global Privacy Control, because SourceTrack respects both. Then see the troubleshooting guide.
Next step
Tag the links you share, then watch the leads come in. Learn the basics in how to track UTM parameters, check your links with the UTM validator, read the install guide or the troubleshooting guide, or see how every tool connects. Using a different form tool? The Gravity Forms guide and the Calendly guide follow the same pattern.
Related Blogs
How to Track UTM Parameters: The Basics
Learn what UTM parameters are, how to build tagged links, and how to see which campaign sent each lead. Plain steps, no code.
SourceTrack Team
Attribution & Growth Engineering
20 Oct, 2026
How to Track UTM Parameters in Cal.com
See which campaign sent each Cal.com booking. Add one script tag to the page with your embed, then test with a UTM link.
SourceTrack Team
Attribution & Growth Engineering
20 Oct, 2026
How to Track UTM Parameters in Calendly
See which campaign sent each Calendly booking. Add one script tag to the page with your embed, then test with a UTM link.
SourceTrack Team
Attribution & Growth Engineering
20 Oct, 2026


