Description
FormWake for HubSpot embeds forms built with HubSpot’s updated form editor without the official HubSpot plugin. It focuses on three things:
- Performance: the HubSpot form script is only loaded when a form comes close to the viewport (IntersectionObserver). A placeholder with a fixed minimum height prevents layout shift (CLS).
- Cookie banners: the form script can be exempted from marketing consent blocking via a filter, so forms keep working for visitors who decline marketing cookies.
- GTM tracking: form events are pushed to
window.dataLayerashubspot_form_ready,hubspot_form_submitandhubspot_form_error(names configurable). Only IDs and the page path are sent – never field values or other personal data.
Assets are only loaded on pages that actually contain a form. No jQuery, no build step, no HTTP requests from PHP.
This plugin is not affiliated with or endorsed by HubSpot, Inc.
Requirements in HubSpot
- The form must be created with the updated HubSpot form editor. Legacy forms are not supported.
- Add your website domain in HubSpot under the tracking code / domain settings. HubSpot marks submissions from domains that are not added as spam.
- The developer embed (no iframe) requires a Marketing Hub or Content Hub Professional or Enterprise subscription.
Usage
Enter your portal ID and region under Settings → FormWake. Then add the shortcode to any page (works in the block editor’s Shortcode block, Elementor, Divi and classic content):
[formwake id="FORM-UUID" min_height="400"]
id(required): the form ID (UUID) from the HubSpot embed code (data-form-id).min_height(optional, default 400, max 3000): placeholder height in pixels to avoid layout shift.
dataLayer payload
{ event, form_id, instance_id, page_path, conversion_id }
The conversion_id field is only included on successful submissions. page_path contains the path without query string.
Cookie banner exceptions
Use the formwake_script_attributes filter to add attributes your consent tool needs to leave the scripts alone:
add_filter( 'formwake_script_attributes', function ( $attributes, $context ) {
$attributes['data-cookieconsent'] = 'ignore'; // Cookiebot
return $attributes;
}, 10, 2 );
The $context parameter is loader (this plugin’s own script tags) or embed (the HubSpot form script). Please check with your legal advisor whether loading the HubSpot form script without consent is acceptable for your use case.
External services
This plugin embeds forms from HubSpot (HubSpot, Inc.), an external service. Without it, the plugin has no function.
- What is loaded: the HubSpot form embed script from
js.hsforms.net(region na1) orjs-{region}.hsforms.net(e.g.js-eu1.hsforms.net). This script then loads the form and further resources from HubSpot domains. - When: only on pages that contain the
[formwake]shortcode – with lazy loading enabled, only once a form comes close to the visible area of the page. - What data is sent: loading the script transmits the visitor’s IP address, browser information and the page URL to HubSpot, as with any external resource. When a visitor submits a form, the entered form data is sent to HubSpot and stored in the site owner’s HubSpot account. The plugin itself does not send any data to HubSpot from the server.
- HubSpot terms of service: https://legal.hubspot.com/terms-of-service
- HubSpot privacy policy: https://legal.hubspot.com/privacy-policy
The dataLayer events are only written to the window.dataLayer array in the visitor’s browser. No data is sent to Google or any other service unless the site owner has installed Google Tag Manager (or a similar tool) separately.
Installation
- Upload the plugin folder to
/wp-content/plugins/or install it via Plugins → Add New. - Activate the plugin.
- Configure it under Settings → FormWake.
FAQ
Does it work with legacy HubSpot forms?
No. Version 0.1 supports forms from the updated form editor only.
Where do I find the form ID and region?
In HubSpot, open the form and click “Get embed code”. The code contains data-form-id, data-portal-id and data-region.
Do multiple forms on one page work?
Yes. The HubSpot script is loaded only once per page. When the first form comes close to the viewport, all forms on the page are initialized.
Debug mode shows nothing
Debug output is only printed for logged-in administrators. If you use a page cache that also caches pages for logged-in users, exclude administrators from caching.
Screenshots

![A HubSpot form embedded with the [formwake] shortcode. The HubSpot script only loads when the form comes close to the viewport.](https://ps.w.org/formwake-for-hubspot/assets/screenshot-2.png?rev=3831222)


Changelog
0.2.0
- Settings page redesign: status box, sections as cards, help sidebar with copy-to-clipboard shortcode, GTM and cookie banner tips.
- Admin CSS/JS are loaded on the FormWake settings page only.
0.1.0
- Initial release: settings page, shortcode, lazy loading, dataLayer events, script attribute filter.
