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.

Want to apply this to your setup?
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>| Field | Where it comes from | Use it for |
|---|---|---|
| utm_* (first and last touch) | Campaign link parameters | Campaign and channel reporting |
| gclid | Google Ads auto-tagging | Offline conversion import into Google Ads |
| fbclid / msclkid / li_fat_id | Meta, Microsoft and LinkedIn ad clicks | Matching leads to paid social and Bing campaigns |
| landing_page | First page of the visit | Which content starts conversations |
| referrer | External site that sent the visitor | Untagged referrals, partners, AI search tools |
| first_visit | Timestamp of the first stored visit | Time 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 field | HubSpot property | Type | Overwrite rule |
|---|---|---|---|
| utm_source, utm_medium, utm_campaign | utm_source, utm_medium, utm_campaign | Single-line text | Last touch: update on every submission |
| utm_term, utm_content | utm_term, utm_content | Single-line text | Last touch: update on every submission |
| first_utm_source, first_utm_medium, first_utm_campaign | first_utm_source, first_utm_medium, first_utm_campaign | Single-line text | First 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
- Open a page with
?utm_source=test&utm_medium=cpc&utm_campaign=qaand submit the form: every value should reach HubSpot. - Land with UTMs, click to a second page, then submit: the values should still be there.
- Visit with no UTMs: the form should submit normally with empty attribution fields.
- Return with a different campaign: last-touch should change while first-touch stays the same.
- 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
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.
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.
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.





