Introduction
This guide outlines steps to troubleshoot the Gravity Forms HubSpot Add-On issue, where the following message is displayed in the HubSpot console:
“The cookie needed to link form submissions to existing contacts isn’t being sent. You’ll need to ask your developer to update the integration for this form.“
Troubleshooting
Verify The HubSpot Script Is Included
The HubSpot tracking script is required to set the hubspotutk
cookie, which links form submissions to existing contacts. To confirm the script is present:
- View the Page Source Code: Open the page containing your form in a browser, right-click, and select View Page Source (or use
Ctrl+U
/Cmd+U
). - Search for the HubSpot Script: Look for the following script in or after the footer. It should resemble the code below, though it may vary slightly if included by a theme or plugin.
Replace{your_portal_id_here}
with your HubSpot portal ID.
<!-- Start of Async HubSpot Analytics Code -->
<script type="text/javascript">
(function(d,s,i,r) {
if (d.getElementById(i)){return;}
var n=d.createElement(s),e=d.getElementsByTagName(s)[0];
n.id=i;n.src='//js.hs-analytics.net/analytics/'+(Math.ceil(new Date()/r)*r)+'/{your_portal_id_here}.js';
e.parentNode.insertBefore(n, e);
})(document,"script","hs-analytics",300000);
</script>
<!-- End of Async HubSpot Analytics Code -->
- Check for Disabled Scripts: If the script is missing, ensure the
gform_hubspot_output_tracking_script
filter hasn’t been used to disable it. This filter can prevent the script from being output.
Check If The hubspotutk
Cookie Is Set
The hubspotutk
cookie must be set on the page render for the integration to work. To verify this:
- Open the Browser Developer Tools.
- Navigate to the Application tab (or Storage in some browsers).
- Look for the
hubspotutk
cookie under Cookies > your domain.
If the cookie is missing, proceed to the next steps to identify the cause.
Test Form Submission With Network Tools
To confirm the hubspotutk
cookie is being sent with form submissions:
- Open the browser’s Developer Tools and go to the Network tab.
- Submit the form.
- Inspect the form submission request in the Network tab.
- Check the Cookies tab for the request. The
hubspotutk
cookie should be listed.
If the cookie is missing, it indicates that it was either not set or included in the submission.
Enable Logging For The HubSpot Add-On
Gravity Forms provides logging for the HubSpot Add-On, which can help diagnose issues:
- Go to Forms > Settings > Logging in your WordPress admin.
- Enable logging for the HubSpot Add-On.
- Submit the form again and review the logs.
- Look for the
hutk
key in the payload’scontext
array. This should contain thehubspotutk
cookie value.
If the hutk
value is missing, it means the cookie wasn’t set or passed correctly.
Common Causes and Solutions
If you’ve identified an issue at any of the above stages, here are some common causes and solutions:
Problem | Solution |
---|---|
Caching and optimization. Caching plugins or services (e.g., WP Rocket, W3 Total Cache) and external services like Cloudflare and their Rocket Loader feature can prevent the HubSpot script from running, which stops the cookie from being set. | Pages containing forms should be excluded from caching and script optimization features. For more details, see our FAQ on Cache and Script Optimizer Issues. |
Cookie Opt-In Features. Themes or plugins that offer cookie consent features (e.g., GDPR compliance tools) may block the HubSpot script. | Test with cookie opt-in features disabled. If this resolves the issue, contact the developer of the theme or plugin that includes the opt-in feature for assistance in ensuring it triggers the script upon opt-in. |
Browser Cookie Settings. Some browsers (e.g., Brave, Firefox) block cookies by default, or users may have configured their browsers to block cookies. | Test the form in a different browser or with adjusted cookie settings and disable any ad-blocking browser extensions. |
Trigger The HubSpot Script On Submission
If the hubspotutk
cookie isn’t being set, you can try using a JavaScript snippet to trigger the HubSpot script on form submission. This should set the cookie before the form data is sent to HubSpot.
For instructions, see our documentation on Triggering the HubSpot Tracking Script.