How to Capture UTM Parameters in Webflow Forms Automatically

How to Capture UTM Parameters in Webflow Forms Automatically

Webflow
Make
GTM
Hubspot
21st May, 2026

By Pavel Vainshtein, Webflowforge · Updated November 15, 2026

Short answer: add hidden fields named utm_source, utm_medium, utm_campaign, utm_term and utm_content to your Webflow form, then add a short script that reads the URL, saves first-touch values in localStorage and fills the fields on every page. Map the fields to matching HubSpot contact properties with Make or n8n, keeping first-touch and last-touch in separate properties. The full script, a click-ID add-on and a test routine are below.

Start by adding hidden input fields inside your Webflow form block, named exactly after the tracking variables. Then embed this snippet in Site settings → Custom code (before </body>), or on the pages that have forms:

<script>
document.addEventListener('DOMContentLoaded', () => {
  const KEYS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content'];
  const params = new URLSearchParams(window.location.search);
  const current = {};
  KEYS.forEach(k => { const v = params.get(k); if (v) current[k] = v.slice(0, 255); });
  const hasCurrent = Object.keys(current).length > 0;

  let first = {}, last = current;
  try {
    first = JSON.parse(localStorage.getItem('wf_first_touch') || '{}');
    if (!Object.keys(first).length && hasCurrent) {
      first = current;                                   // set once, never overwritten
      localStorage.setItem('wf_first_touch', JSON.stringify(first));
    }
    if (hasCurrent) localStorage.setItem('wf_last_touch', JSON.stringify(current));
    else last = JSON.parse(localStorage.getItem('wf_last_touch') || '{}');
  } catch (e) { /* storage blocked: use the current page only */ }

  const fill = (name, value) => document.querySelectorAll(`input[name="${name}"]`)
    .forEach(input => { if (value) input.value = value; });
  KEYS.forEach(k => { fill(k, last[k]); fill(`first_${k}`, first[k]); });
});
</script>

The script keeps last-touch values in the standard utm_ fields and the first campaign a visitor arrived from in matching first_utm_ fields, so values survive when the visitor browses several pages before submitting. Only store attribution in browser storage when your consent setup allows it.

Routing Webflow Form Data to HubSpot Using Make

Once your Webflow form successfully captures hidden UTM data, you can seamlessly route this information to HubSpot using Make.com without writing complex API integrations. Create a new scenario in Make using a "Watch Form Submissions" Webflow trigger, which instantly captures incoming form data as a webhook payload. Next, add a HubSpot "Create or Update a Contact" module to your workflow, mapping the standard contact information along with your custom Webflow UTM fields directly to your matching HubSpot contact properties to preserve clean, multi-touch attribution data.

Webflow form submission with UTM capture flowing through a Make scenario into a HubSpot contact with attribution data

Want to apply this to your setup?

Tell us about your stack and we’ll break down how this playbook would work for you.
See How

Capture click IDs, landing page and referrer too

UTMs only exist when someone tagged the link. Paid clicks also carry an ad platform click ID, and organic or referral visits carry none of these, so capture the landing page and external referrer as well. Without them, every untagged lead lands in HubSpot as "unknown".

<script>
// Add-on to the UTM script: ad click IDs, landing page and referrer.
// Hidden fields needed: gclid, fbclid, msclkid, li_fat_id, landing_page, referrer, first_visit
(function () {
  const CLICK_IDS = ['gclid', 'fbclid', 'msclkid', 'li_fat_id'];
  const p = new URLSearchParams(location.search);
  let s = {};
  try { s = JSON.parse(localStorage.getItem('wf_session_attr') || '{}'); } catch (e) {}

  CLICK_IDS.forEach((k) => { if (p.get(k)) s[k] = p.get(k).slice(0, 255); });
  if (!s.landing_page) s.landing_page = location.pathname;          // first page of the visit
  if (!s.referrer && document.referrer && !document.referrer.includes(location.hostname)) {
    s.referrer = document.referrer.slice(0, 255);                     // external referrer only
  }
  if (!s.first_visit) s.first_visit = new Date().toISOString();

  try { localStorage.setItem('wf_session_attr', JSON.stringify(s)); } catch (e) {}

  document.querySelectorAll('form').forEach((form) => {
    Object.entries(s).forEach(([k, v]) => {
      const input = form.querySelector(`input[name="${k}"]`);
      if (input && !input.value) input.value = v;
    });
  });
})();
</script>
Attribution fields worth sending to HubSpot
FieldWhere it comes fromUse it for
utm_* (first and last touch)Campaign link parametersCampaign and channel reporting
gclidGoogle Ads auto-taggingOffline conversion import into Google Ads
fbclid / msclkid / li_fat_idMeta, Microsoft and LinkedIn ad clicksMatching leads to paid social and Bing campaigns
landing_pageFirst page of the visitWhich content starts conversations
referrerExternal site that sent the visitorUntagged referrals, partners, AI search tools
first_visitTimestamp of the first stored visitTime from first visit to enquiry

If you run a consent banner, load these scripts only after analytics or marketing consent, or store values in sessionStorage until consent is given. Check what your privacy policy says before persisting identifiers.

Capturing values is step one; keeping them attached to the contact is the real work. Our Webflow HubSpot integration passes first-touch UTMs, click IDs and the HubSpot tracking cookie into HubSpot so attribution survives to closed-won.

Does this work outside Webflow — Paperform, Fluent Forms, HubSpot forms?

Yes — the pattern is tool-agnostic: hidden fields plus a script (or built-in merge tag) that copies URL parameters into them.

  • UTM parameters in Paperform: Paperform reads URL parameters natively — add hidden fields whose keys match (utm_source, etc.) and pass values via the form URL or embed. No script needed.
  • UTM parameters in Fluent Forms (WordPress): add hidden fields and use the default-value shortcode {get.utm_source} to pull each parameter from the query string.
  • HubSpot native forms: HubSpot auto-captures original source analytics, but explicit UTM contact properties still win for reporting — add hidden fields to the form and they populate from the URL automatically.

Whichever form tool you use, persist first-touch values in a cookie or localStorage so attribution survives multi-page journeys — the script above does exactly that for any HTML form.

Create matching HubSpot properties and test the flow

Create a HubSpot contact property for every hidden field before connecting Make, and set the overwrite rule deliberately. Use the property's internal name in the mapping, not its label.

Webflow hidden fields mapped to HubSpot contact properties
Webflow hidden fieldHubSpot propertyTypeOverwrite rule
utm_source, utm_medium, utm_campaignutm_source, utm_medium, utm_campaignSingle-line textLast touch: update on every submission
utm_term, utm_contentutm_term, utm_contentSingle-line textLast touch: update on every submission
first_utm_source, first_utm_medium, first_utm_campaignfirst_utm_source, first_utm_medium, first_utm_campaignSingle-line textFirst touch: only fill when empty

In Make, protect the first-touch properties with an ifempty() mapping or a filter so a returning contact never loses the campaign that introduced them.

Test the flow before launch

  1. Open a page with ?utm_source=test&utm_medium=cpc&utm_campaign=qa and submit the form: every value should reach HubSpot.
  2. Land with UTMs, click to a second page, then submit: the values should still be there.
  3. Visit with no UTMs: the form should submit normally with empty attribution fields.
  4. Return with a different campaign: last-touch should change while first-touch stays the same.
  5. Check the HubSpot contact: properties filled and no duplicate contact created.

Debug empty attribution fields in two minutes

If a submission arrives without UTM or click ID values, open a form page with ?utm_source=test&utm_medium=qa&gclid=abc and run this in the browser console. It shows what every hidden field holds and what the script stored:

document.querySelectorAll('form input[type="hidden"]').forEach((i) =>
  console.log(i.name.padEnd(14), '→', i.value || '(empty)')
);
console.log('first touch:', localStorage.getItem('wf_first_touch'));
console.log('last touch :', localStorage.getItem('wf_last_touch'));
console.log('session    :', localStorage.getItem('wf_session_attr'));
  • Field shows (empty) but storage has values: the hidden field name differs from the script key, often by a capital letter or a space.
  • Storage is null: the script did not run. Check that it is published, not blocked by the consent tool, and not throwing an error earlier in the console.
  • Values fine on page load, missing in the submission: the form is inside a popup or loaded later. Run the fill step again when the popup opens.
  • Webflow has the values, HubSpot does not: the Make or n8n mapping points at the label instead of the property's internal name.

Want this built for you?

Webflowforge builds Webflow automation services that connect your forms, CMS and CRM for service companies and SaaS teams. Tell us about your project and we'll scope it with you.

Related guides: Webflow SEO attribution with GA4 and HubSpot · Sync Webflow forms to HubSpot with Make · Connect Webflow forms to Notion

Frequently Asked Questions

Should UTM values be stored as first-touch or last-touch?

Store both in separate properties. First-touch shows which campaign introduced the lead; last-touch shows what brought them back to convert. Overwriting one field on every visit loses half of that story.

Why are my UTM hidden fields empty in Webflow submissions?

Common causes are field names that do not match the script exactly, a script that runs before the form exists, a visitor who browsed to another page when values are not persisted, a consent tool blocking the script, or a hidden field placed outside the form element.

Do UTM parameters hurt SEO?

Not when they are used only on external campaign links. Never add UTMs to internal links, and keep a canonical tag on each page pointing to the clean URL so search engines do not treat parameter versions as separate pages.

Image of author
Pavel Vainshtein
Founder, Webflowforge | B2B & SaaS Websites, CRM Integration & AI Automation
Pavel Vainshtein founded Webflowforge in Kiryat Bialik, Israel. He works with B2B and SaaS teams on website design, Webflow and WordPress development, HubSpot CRM integration, and AI automation with n8n and Make. His work connects websites with marketing and revenue operations.