On this page
What this issue is
HubSpot's tracking code sets a cookie called hubspotutk in the visitor's browser. It holds a random ID for that browser. When a form is submitted, HubSpot reads this value (called hutk, short for HubSpot user token) and attaches the new or updated contact to that visitor's history: pages viewed, first source, UTMs and ad click data.
- Ad clickVisitor lands with UTMs
- Tracking codehubspotutk cookie set
- Form submithutk not sent
- Contact createdNo page history
- Source reportShows Offline or Direct
The visit is tracked, but the form submission carries no hutk, so the contact cannot be joined to it.
Why it costs you leads or sales
Example: 100 paid leads in a month. With hutk missing on one form, many are reported as Offline or Direct.
How to check if your site has it
Confirm the cookie is set
Open the page in a fresh browser window, accept cookies if a banner shows, then open DevTools > Application (Chrome) or Storage (Firefox) > Cookies. Look for
hubspotutkon your domain.Watch the form request
Open DevTools > Network, tick Preserve log, then submit the form with a test email. Find the request to
api.hsforms.comorforms.hubspot.com, or to your own endpoint if the form is custom.Look for hutk in the payload
For the Forms API, the payload should contain
contextwithhutkset to the cookie value. For older endpoints it is ahutkfield. If it is absent or empty, you have the issue.Check the contact in HubSpot
Open the test contact and view its activity timeline. A linked contact shows page views before the form fill. An unlinked one shows only the form submission.
| Cause | What you see |
|---|---|
| Tracking code not on the page | No hubspotutk cookie at all |
| Consent banner blocks HubSpot cookies | Cookie appears only after accepting |
| Custom form posts to Forms API without context | Cookie exists, payload has no hutk |
| Form in an iframe or other domain | Cookie set on the main site, not read by the form |
| Tracking code loads after the form script | Cookie missing on first page view |
How to fix it
Install the tracking code
Use the official HubSpot plugin and connect your account, or paste the tracking script into your theme footer. Check that caching plugins do not strip it.
Use HubSpot forms where you can
HubSpot's embedded forms and the plugin's form blocks read the cookie for you. If you use Gravity Forms, Contact Form 7 or similar, use an integration that passes hutk, or send it yourself as shown in Custom code.
Add the tracking code as a tag
Create a Custom HTML tag with your HubSpot script and fire it on All Pages. Respect your consent setup by using consent-aware triggers.
Expose the cookie to forms
Create a First-party cookie variable named
hubspotutk. Use it in a tag or data layer push that adds it to your form submission.
Add the code in Project Settings
Go to Project Settings > Custom code > Footer code and paste the HubSpot tracking script. Publish the site.
Pick the right form route
Native Webflow forms do not send to HubSpot with hutk by default. Embed a HubSpot form, or send the submission through the Forms API with the cookie value.
Read the cookie
Read
hubspotutkfromdocument.cookieat submit time.Send it in context
Add
context.hutk(pluspageUriandpageName) to the JSON body you post to the Forms API.
function getHutk() {
var m = document.cookie.match(/(?:^|; )hubspotutk=([^;]*)/);
return m ? decodeURIComponent(m[1]) : undefined;
}
function submitToHubSpot(portalId, formGuid, email) {
return fetch('https://api.hsforms.com/submissions/v3/integration/submit/' + portalId + '/' + formGuid, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
fields: [{ name: 'email', value: email }],
context: {
hutk: getHutk(),
pageUri: window.location.href,
pageName: document.title
}
})
});
}Load tracking first
Make sure the HubSpot script is on every page that has a form and loads before the form is submitted.
Handle consent
If your banner blocks HubSpot until consent, accept that visitors who decline will have no hutk. That is expected. Make sure it is set once they accept.
Pass hutk from the form
Embedded HubSpot forms do this automatically. Custom forms need the code above.
Keep the domain consistent
For iframes or forms on another domain, pass the cookie value in the URL or a message to the form and send it in the submission.
How to confirm it's fixed
- Open the page in a clean browser, accept cookies, and see
hubspotutkin Cookies. - Submit a test lead and confirm
context.hutkis filled in the network request. - Open the new contact in HubSpot and see page views before the form fill in the timeline.
- Check that original source and UTMs match the test visit (use a URL with UTMs).
- Repeat on mobile and with your consent banner in its default state.
hutk missing
- Timeline shows only the form submission
- Original source: Offline or Direct
- No page views or UTMs
hutk sent
- Timeline shows earlier page views
- Original source matches the campaign
- UTMs and page history available
How to prevent it happening again
- Add a hutk check to your launch list for every new form or landing page.
- Re-test after changing themes, caching, consent banners or tag setups.
- Prefer HubSpot's embedded forms when you do not need a custom design.
- Document which forms are custom and how they send hutk.
- Review a few new contacts each week for missing page history.
How FunnelGuard handles this
Questions people ask
What is hutk in HubSpot?
hutk is the value of the hubspotutk cookie, which HubSpot sets in a visitor's browser. When it is sent with a form submission, HubSpot links the contact to that visitor's page views and source.
Why is my HubSpot form submission not linked to the visitor?
The most common causes are a missing tracking code, a consent banner blocking the cookie, or a custom form that posts to HubSpot without context.hutk. Check the network request when you submit a test lead and look for hutk.
How do I add hutk to a custom form?
Read the hubspotutk cookie in JavaScript and include it as context.hutk in the body of your Forms API request. If the lead is sent from your server, pass the cookie value in a hidden field first.
Why does my HubSpot contact show Offline as the original source?
Contacts created without a linked visitor often have no web history, so HubSpot may label them Offline. A missing hutk is one common reason, but not the only one, so check the cookie and payload first.
Do embedded HubSpot forms send hutk automatically?
Yes, if the HubSpot tracking code is on the page and the cookie is set, embedded HubSpot forms include it for you. The problem mainly affects custom forms and forms from other tools.
Does a cookie consent banner stop hutk from being sent?
It can. If your banner blocks HubSpot's cookie until consent is given, visitors who decline will have no hubspotutk, so their submissions will not be linked. That is expected behaviour, but check that the cookie appears after acceptance.
Can FunnelGuard tell me if hutk is missing?
Not yet. This check is not part of FunnelGuard today. You can test manually by submitting a lead and looking at the contact timeline in HubSpot.
Related issues
- TRK-267HubSpot tracking code missingFix guide
- TRK-269HubSpot original source shows 'Offline' for web leadsFix guide
- TRK-270UTMs not written to CRM contact fieldsFix guide
- TRK-278Hidden UTM fields present but emptyFix guide
- TRK-277Lead source field overwritten on later visitsFix guide
- TRK-271gclid/fbclid not written to CRMFix guide