If your HubSpot forms suddenly stop appearing on your WordPress site—especially for first-time visitors or users who haven’t accepted cookies—the issue is often not with HubSpot itself, but with how scripts are being blocked or optimized.
In this case, forms were missing entirely on key pages, appearing only after a hard refresh, and behaving inconsistently between users.
The root cause was a combination of cookie consent blocking (Osano) and aggressive caching/minification settings.
Issue Background
The site used:
- HubSpot embedded forms (JavaScript)
- Osano cookie consent manager
- Multiple caching plugins including W3 Total Cache and WP Fastest Cache
Symptoms included:
- Forms not rendering on key pages
- Forms appearing only after accepting cookies or hard refresh
- JavaScript error:
hbspt is not defined
Diagnosis
Cookie consent blocking scripts
Osano was blocking HubSpot scripts (js.hsforms.net, hsforms.com) as non-essential, preventing them from loading.
JavaScript dependency
HubSpot forms rely entirely on JavaScript. If the script is blocked, the form does not render at all.
Caching conflicts
Running multiple caching plugins and aggressive JS optimization caused scripts to load out of order or not at all.
Resolution Steps
Step 1: Allow HubSpot scripts in Osano
Update cookie settings to allow:
- js.hsforms.net
- hsforms.com
Step 2: Separate essential vs tracking cookies
Allow required CDN cookies while keeping tracking cookies consent-based.
Step 3: Reduce caching complexity
Use only one caching plugin and remove overlapping optimizations.
Step 4: Exclude HubSpot scripts from optimization
js.hsforms.net
hsforms.com
Step 5: Clear all caches
Clear plugin, server, and CDN cache and test in incognito.
Step 6: Validate across scenarios
Test for first-time visitors, returning users, and logged-out sessions.
Final Outcome
After implementing these fixes:
- HubSpot forms load consistently
- Cookie consent no longer blocks form rendering
- JavaScript errors are resolved
- Caching conflicts are minimized
If your forms are not appearing or behaving inconsistently, contact Freshy for expert troubleshooting and WordPress support.