What `hutk` does
`hutk` is the value from HubSpot's `hubspotutk` tracking cookie. When you pass it in `context.hutk`, HubSpot can connect the form submission to the visitor's tracked session.
If the value is missing or empty, the submission may still work, but attribution, contact activity, source reporting, and page conversion data can be less useful.
Common causes
1. The HubSpot tracking cookie is not available
The visitor may be new, tracking may be blocked, cookie consent may not have been granted, or the HubSpot tracking script may not have loaded yet.
2. The backend cannot read browser cookies
If your API request is created on the server, the server only sees cookies sent to your domain. Make sure the frontend sends the `hubspotutk` value to your backend when you need to submit from PHP.
3. The payload includes an empty string
Sending `"hutk": ""` is usually less useful than omitting the key. An empty value can hide the real bug because the payload appears to contain hutk even though HubSpot cannot use it.
{
"context": {
"pageUri": "https://example.com/contact",
"pageName": "Contact",
"hutk": ""
}
}
4. The cookie is read from the wrong domain
If the form lives on one domain but the request is assembled on another, your JavaScript or PHP code may not have access to the same cookies.
Safer context payload
If you have a real `hubspotutk` value, include it. If you do not, keep `pageUri` and `pageName`, then omit `hutk` instead of sending an empty string.
{
"fields": [
{
"name": "email",
"value": "developer@example.com"
}
],
"context": {
"pageUri": "https://example.com/contact",
"pageName": "Contact",
"hutk": "real-hubspotutk-cookie-value"
}
}
PHP pattern
In PHP, only add `hutk` to the context when the cookie value is present. This keeps the request honest and makes missing tracking easier to debug.
$context = [
'pageUri' => 'https://example.com/contact',
'pageName' => 'Contact',
];
if (!empty($_COOKIE['hubspotutk'])) {
$context['hutk'] = $_COOKIE['hubspotutk'];
}
$payload = [
'fields' => [
[
'name' => 'email',
'value' => 'developer@example.com',
],
],
'context' => $context,
];