Let’s be honest—most guides on adding forms to WordPress gloss over the one thing that matters: keeping your site fast. If you’re running a site that gets any traffic (or you care about SEO), you can’t just slap a third-party script on your pages and hope for the best. If you use HubSpot Forms, you already know their embed is convenient, but you’ve probably seen it tank your PageSpeed scores, too.
This guide is for anyone who wants the lead-gen benefits of HubSpot Forms without nuking their site’s performance. I’ll walk you through options, what actually works, and how to avoid the usual slowdowns.
The Problem: Why HubSpot Forms Can Slow Down Your WordPress Site
HubSpot's embed script is easy—just copy and paste. But here’s what most folks don’t tell you:
- The default embed loads extra JavaScript from HubSpot’s servers on every page where the form appears.
- These scripts are render-blocking (they can delay your whole page from loading).
- HubSpot’s JavaScript loads more scripts as it runs—so it’s not just one small file.
If you care about fast load times (and you should), you need to do better than default.
Step 1: Decide—Do You Really Need HubSpot’s Embedded Form?
Before you start, ask: Do I actually need the full HubSpot embed, or just the data in HubSpot? Sometimes you can get away with a lighter solution.
Here’s what to consider:
- Do you need advanced features? (progressive fields, prefill, smart content) → You have to use HubSpot’s embed.
- Just want to capture leads in HubSpot? You can use a native WordPress form plugin (like Gravity Forms or WPForms) with a HubSpot add-on. This is much faster, but you might lose some of HubSpot’s fancier features.
Pro tip: If you don’t need advanced HubSpot features, skip to Step 6: Use a WordPress form plugin with HubSpot integration. It’s cleaner, faster, and won’t break your site.
Step 2: Get the HubSpot Embed Code
If you’re sticking with HubSpot’s form, get the embed code:
- Log into your HubSpot account.
- Go to Marketing > Lead Capture > Forms.
- Open the form you want.
- Click "Share," then "Embed."
- Copy the JavaScript code snippet.
It’ll look like this:
html
Step 3: Don’t Paste the Script Everywhere
This is where most people go wrong. If you drop the script in your site footer or a global widget, it’ll load on every page—whether there’s a form or not.
Only load the script on the pages that actually have your form.
How:
- If you’re using the Block Editor, add it only to the page/post where the form should appear.
- If you’re using a page builder (like Elementor), use their HTML/Shortcode widget in just the right spot.
- Avoid putting the script in global template files (header/footer.php).
Step 4: Delay Loading the Script (“Lazy Load”)
The real trick to keeping your site fast is not loading the HubSpot script until the user actually needs it—usually after the page has loaded.
Option 1: Use a Lazy Load Script Loader (Recommended)
There are plugins that can delay when third-party scripts run. My favorite for this job is Flying Scripts (free).
How to set it up:
- Install and activate Flying Scripts.
- In the plugin settings, add
js.hsforms.net
to the list of scripts to delay. - Set the delay—usually 3 to 5 seconds is safe.
What this does: The rest of your page loads first, and the HubSpot form only loads after the delay (or after user interaction, if configured).
Downsides: The form won’t appear immediately—but unless you put your form above the fold, this is usually fine.
Option 2: Manually Lazy Load with Intersection Observer
If you want more control and aren’t afraid of a little code, you can load the form only when it scrolls into view.
Basic approach:
-
Add a container div where you want the form:
html
-
Add this script (in your page or a code block plugin):
html
What this does: The HubSpot scripts only load when the user scrolls to the form. Until then, your page stays fast.
Option 3: Use a Plugin to Insert Code On Specific Pages
If you’re not comfortable editing code, plugins like Insert Headers and Footers or WPCode let you add code just to certain pages or posts. Combine with the lazy load methods above for the best results.
Step 5: Test the Real-World Impact
Don’t take my word for it—test your setup.
- Use PageSpeed Insights or WebPageTest on your form page.
- Check both desktop and mobile.
- Look for "Reduce unused JavaScript" or "Eliminate render-blocking resources" warnings. If you’re still seeing them, your form script is still hurting performance.
Pro tip: If your form is below the fold, most users won’t even notice a one- or two-second delay. But if you must have it load instantly, you’ll have to live with slower scores—no way around it.
Step 6: Use a WordPress Form Plugin with HubSpot Integration (If You Can)
If you only care about leads going into HubSpot, you can skip the embed altogether. Use a fast, native WordPress form plugin with a HubSpot integration.
Popular options:
- Gravity Forms: Paid add-on for HubSpot. Fast and powerful.
- WPForms: HubSpot integration available, user-friendly.
- Formidable Forms: Also supports HubSpot integration.
Why this is faster:
- No third-party scripts loaded on your page.
- Forms load instantly—no render-blocking.
- You keep full control of form styling and behavior.
Downsides:
- No progressive profiling, no smart content, limited tracking.
- If you rely on HubSpot’s analytics or advanced features, this isn’t for you.
Step 7: Ignore Bad Advice (What Doesn’t Work)
- Don’t use iframes: HubSpot doesn’t provide a true iframe embed (and if it did, it’d still load slow).
- Don’t put scripts in your global header: This makes every page slower, even ones without forms.
- Don’t trust “all-in-one” performance plugins: Some will merge or defer scripts, but they can break third-party forms (including HubSpot). Test everything, and don’t assume it “just works.”
Step 8: Extra Tips for Speed Freaks
- Minimize plugins: Every plugin adds overhead. Only keep what you need.
- Use good hosting: Slow hosting will make everything worse, even the best-optimized form.
- Cache your pages: Use a reputable caching plugin (WP Rocket, W3 Total Cache, etc.).
- Optimize images: HubSpot’s form won’t slow down images, but big images will still crush your score.
A Quick Recap: Keep It Simple
If you really need HubSpot’s magical features, lazy load the embed script. If you just need the leads, use a native WordPress form with HubSpot integration. Don’t overengineer it—test your results, iterate, and make changes only where it actually matters. Fast sites make for happy users (and better SEO), so don’t let a form slow you down.